node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »

zog

zog

A wrapper around the debug module to infer logger namespace from filename, support logging levels, and have support for CommonJS and ES6.

Install

npm i zog

Usage

Infer namespace from filename

// foo/bar.js 
 
import {log, info, debug, warn, error} from 'live-log'
 
log('hello')
info('hello')
debug('hello')
warn('hello')
error('hello')

Output

foo/bar hello
foo/bar hello
foo/bar hello
foo/bar WARNING: hello
foo/bar ERROR: hello

Explicit namespace

// foo/index.js 
 
const logger = require('live-log')('foo')
 
logger.log('hello')
foo hello

API

default logger Logger info log debug warn error

Convenience

time timeEnd xcolor xc c Debug