how to use vuejs3-logger with quasar *the correct way*?
#13531
-
|
i would like to use something like currently i feel a bit lost on how to setup this properly. import VueLogger from 'vuejs3-logger';
import { createApp } from 'vue';
const isProduction = process.env.NODE_ENV === 'production';
const options = {
isEnabled: true,
logLevel : isProduction ? 'error' : 'debug',
stringifyArguments : false,
showLogLevel : true,
showMethodName : true,
separator: '|',
showConsoleColors: true
};
createApp({}).use(VueLogger, options);so i translated this to a boot file: import { boot } from 'quasar/wrappers'
import VueLogger from 'vuejs3-logger';
export default boot(({app}) => {
const isProduction = process.env.NODE_ENV === 'production';
const options = {
// https://github.com/MarcSchaetz/vuejs3-logger#properties
isEnabled: true,
logLevel : isProduction ? 'error' : 'debug',
stringifyArguments : false,
showLogLevel : true,
showMethodName : true,
separator: '|',
showConsoleColors: true
};
app.use(VueLogger, options);
})in my <template>
<q-page class="flex flex-center">
<q-btn label="log something.." @click="logSomething"/>
</q-page>
</template>
<script setup>
import { defineComponent, inject } from 'vue'
const log = inject('vuejs3-logger')
log.debug('test', 42)
const logSomething = (event) => {
log.debug('logSomething called..', event.target)
console.log('logSomething called..', event.target)
}
</script>in the console i get
so basically it is working - if anybody has any tips or other tools to do some sort of logging in quasar please let me know :-) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
the boot file and the logs looks fine to me, I don't think that's a quasar issue, more like a verbosity config on that library that you're using. |
Beta Was this translation helpful? Give feedback.
the boot file and the logs looks fine to me, I don't think that's a quasar issue, more like a verbosity config on that library that you're using.