1.10.9 • Published 6 years ago

vuejs-console-logger v1.10.9

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

vuejs-logger

npm.io codecov npm npm GitHub license

Provides customizable logging functionality for Vue.js. Compatible with Vue2.

Table of Contents

Demo

@ https://www.webpackbin.com/bins/-KpB0UbGiG2PeFDmqjwi

Introduction

vuejs-logger is a logging library that enables logging for Vue applications. It restricts log messages that are higher than the specified log level. Features include :

  • Colored console messages for $log.warning, $log.error and $log.fatal.
  • Possibility to automatically JSON.stringify() the (reactive) properties passed to the logger.
  • Possibility to display the log level in the console.
logLevels :  ['debug', 'info', 'warn', 'error', 'fatal']

Install

This project uses node and npm. Go check them out if you don't have them locally installed!

$ npm install vuejs-logger --save-exact

Usage

Below you can find an example of how to use vuejs-logger :

import VueLogger from 'vuejs-logger'

const options = {
    logLevel : 'debug',
    // optional : defaults to false if not specified
    stringifyArguments : false,
    // optional : defaults to false if not specified
    showLogLevel : false
}

Vue.use(VueLogger, options)
new Vue({
    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')
        externalFunction()
    }
})

function externalFunction() {
   // log from external function
   Vue.$log.debug('log from function outside component.') 
}

Maintainers

@justinkames.

Contribute

Feel free to dive in! Open an issue or submit PRs.

vuejs-logger follows the Contributor Covenant Code of Conduct.

License

MIT © Justin Kames

1.10.9

6 years ago

1.10.8

6 years ago

1.10.7

6 years ago

1.10.6

6 years ago

1.10.5

7 years ago

1.10.4

7 years ago

1.10.3

7 years ago