nuxt-logger

logger module for nuxtjs

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
nuxt-logger
400.2.05 years ago5 years agoMinified + gzip package size for nuxt-logger in KB

Readme

nuxt-logger
npm npm (scoped with tag) npm (scoped with tag)
A small but helpful logging module for nuxt projects.

Setup

  • Add nuxt-logger to your project using yarn or npm
  • Add nuxt-logger to the modules section of your project's nuxt.config.js

{
  modules: [
   'nuxt-logger',
  ],

  logger: {
   // (optional) custom configuration
  }
}

Custom configuration

logger: {
  isEnabled: true, // true or false, defaults to true
  logLevel: 'debug', // debug, info, warn or error, defaults to debug
}

Usage

There are 4 methods available, one for each log level (debug, info, warn, error) which accept one or more arguments of any kind.
export default {
   methods:{
     foo() {
        this.$log.debug('foo')
        this.$log.info({foo: 'bar'})
        this.$log.warn('warning!')
        this.$log.error('Error', 500)
     }
   }
}

<img src="https://www.dropbox.com/s/drb2u6pxbptn326/screenshot.png?dl=1">

To do

  • Better support for server side rendering
  • x Better support for Safari and Firefox (method name missing)