nuxt-log
A logger module for Nuxt.js using vuejs-logger
Setup
- Add
nuxt-log
dependency using yarn or npm to your project - Add
nuxt-log
to modules
section of nuxt.config.js
const logOptions = {
isEnabled: true,
logLevel : 'debug',
stringifyArguments : false,
showLogLevel : false,
showMethodName : false,
separator: '|',
showConsoleColors: false
}
{
modules: [
['nuxt-log', logOptions],
]
}
Usage
You can use $log in almost any context using app.$log
or this.$log
.
See vuejs-logger official docs for more usage information.
export default {
data() {
return {
a: 'a',
b: 'b',
};
},
created() {
this.$log.debug('test', this.a, 123);
this.$log.info('test', this.b);
this.$log.warn('test');
this.$log.error('test');
this.$log.fatal('test');
},
};
License
MIT License
Copyright (c) webcore-it