All Projects → justinkames → Vuejs Logger

justinkames / Vuejs Logger

Licence: mit
Provides customizable logging functionality for Vue.js. Compatible with Vue2.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Vuejs Logger

Vue2vis
A Vuejs 2 adapter for Visjs
Stars: ✭ 201 (-6.51%)
Mutual labels:  vuejs2
Recall App
🖼️ An open-source and decentralized alternative to Google Photos built on top of Blockstack
Stars: ✭ 212 (-1.4%)
Mutual labels:  vuejs2
Array Explorer
⚡️ A resource to help figure out what JavaScript array method would be best to use at any given time
Stars: ✭ 2,512 (+1068.37%)
Mutual labels:  vuejs2
Easy Dnd
A drag and drop implementation for Vue.js 2 https://codesandbox.io/s/easy-dnd-demo-9mbij https://codesandbox.io/s/easy-dnd-demo-2-xnqbz
Stars: ✭ 202 (-6.05%)
Mutual labels:  vuejs2
Mobx Logger
Log Mobx Actions, Reactions, Transactions and Computations
Stars: ✭ 210 (-2.33%)
Mutual labels:  logger
Vue Wp Starter
A WordPress Vue.js starter plugin
Stars: ✭ 214 (-0.47%)
Mutual labels:  vuejs2
Abap Logger
ABAP Logging as painless as any other language
Stars: ✭ 201 (-6.51%)
Mutual labels:  logger
Vue Element Starter
Vue starter with Element-UI [READY, unmaintained now]
Stars: ✭ 216 (+0.47%)
Mutual labels:  vuejs2
Monolog Bundle
Symfony Monolog Bundle
Stars: ✭ 2,532 (+1077.67%)
Mutual labels:  logger
Awesome Wanandroid
⚡致力于打造一款极致体验的 http://www.wanandroid.com/ 客户端,知识和美是可以并存的哦QAQn(*≧▽≦*)n
Stars: ✭ 2,525 (+1074.42%)
Mutual labels:  logger
Vue Generate Component
Vue js component generator
Stars: ✭ 206 (-4.19%)
Mutual labels:  vuejs2
Paascloud Login Web
模拟商城,完整的购物流程、后端运营平台,使用 spring cloud + vue 全家桶实现快速搭建企业级微服务项目
Stars: ✭ 207 (-3.72%)
Mutual labels:  vuejs2
Toucan
Boilerplate template using Vue.js, TypeScript and .NET Core 2.1, based on SOLID design principles
Stars: ✭ 215 (+0%)
Mutual labels:  vuejs2
Vue Easytable
🍉 Table Component/ Data Grid / Data Table.Support Virtual Scroll,Column Fixed,Header Fixed,Header Grouping,Filter,Sort,Cell Ellipsis,Row Expand,Row Checkbox ...
Stars: ✭ 2,501 (+1063.26%)
Mutual labels:  vuejs2
Nx Admin
👍 A magical 🐮 ⚔ vue admin,记得star
Stars: ✭ 2,497 (+1061.4%)
Mutual labels:  vuejs2
Vue Blocks
Vue2 dataflow graph editor
Stars: ✭ 201 (-6.51%)
Mutual labels:  vuejs2
Vue Analytics
Google Universal Analytics support in Vue.js
Stars: ✭ 213 (-0.93%)
Mutual labels:  vuejs2
V Uploader
A Vue2 plugin make files upload simple and easier, single file upload with image preview, multiple upload with drag and drop
Stars: ✭ 216 (+0.47%)
Mutual labels:  vuejs2
V Bar
The virtual responsive crossbrowser scrollbar component for VueJS 2x
Stars: ✭ 216 (+0.47%)
Mutual labels:  vuejs2
Vue Clip
Simple and hackable file uploader for VueJs. Supports Vue >= 2.1
Stars: ✭ 215 (+0%)
Mutual labels:  vuejs2

vuejs-logger

codecov npm npm GitHub license

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

Table of Contents

Demo

@ https://codepen.io/justinkames/pen/BwGOVQ

Introduction

vuejs-logger is a tool that enables configurable logging for Vue applications. Features include :

  • Output restriction based on selected loglevel.
  • Automatically JSON.stringify() the (reactive) properties passed to the logger.
  • Configurable options to customize output for a log messages.
  • Colored console messages for $log.warning, $log.error and $log.fatal.
logLevels :  ['debug', 'info', 'warn', 'error', 'fatal']

Install

This project uses node and npm.

https://www.npmjs.com/package/vuejs-logger

$ npm install vuejs-logger --save-exact

Usage

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

Properties

Name Required Type Default Description
isEnabled false Boolean true Enables the vuejs-logger plugin, useful toggle for production/development.
logLevel false String 'debug' Choose between ['debug', 'info', 'warn', 'error', 'fatal']. Read production tips.
stringifyArguments false Boolean false If true, all input will go through JSON.stringify(). Useful when printing reactive properties.
showLogLevel false Boolean false If true, the loglevel will be shown.
showMethodName false Boolean false If true, the method name of the parent function will be shown in the console.
separator false String ' l ' The seperator between parts of the output ( see screenshot.
showConsoleColors false Boolean false If true, enables console.warn, console.fatal, console.error for corresponding loglevels.

Code example

import VueLogger from 'vuejs-logger';
const isProduction = process.env.NODE_ENV === 'production';
 
const options = {
    isEnabled: true,
    logLevel : isProduction ? 'error' : 'debug',
    stringifyArguments : false,
    showLogLevel : true,
    showMethodName : true,
    separator: '|',
    showConsoleColors: true
};

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.');
}

Screenshot

screen shot 2017-10-17 at 10 54 05

Production tips

The plugin can be disabled for production or a lower logLevel can be set to minimize output (as shown in usage ). If the logLevel is set to 'fatal' the plugin will ignore all calls with less important loglevels in the code.

    function foo() {
        // these statements will print nothing if the logLevel is set to 'fatal'. But they will compile just fine. 
        this.$log.debug('test', 'bar')
        this.$log.info('test')
        this.$log.warn('test')
        this.$log.error('test', 'foo')
        // this statement will print if the logLevel is set to 'fatal'
        this.$log.fatal('test', 'bar', 123)
    }

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].