console-server
This logging module was created to simplify logging by employing good features with no configuration needed.
Last updated 2 years ago by flaviostutz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install console-server 
SYNC missed versions from official npm registry.

console-server

Inspired on the great 'debug' module and derived from 'console-debug' module. This logging module was created to simplify logging by employing good features with no configuration needed.

Features

const logger = require('console-server');
logger.info('test one!');
  • Use .debug(), .info(), .warn() and .error() for passing contents to be logged
  • Formatters and raw objects can be used, just like with the default 'console'
logger.info('using', {name:'stutz'})
//using {name: 'stutz'}
logger.debug('%s is its name', 'cariota')
//cariota is its name
  • You can pass objects as log arguments
let obj = {title:'chief'};
logger.debug(obj)
//{title:'chief'} 
  • Colors are enabled by default if process is open on a terminal (tty) and disabled otherwise. To force colors enabled/disabled, set environment property LOGGER_USE_COLORS='false'

  • Log level is 'DEBUG' by default. To force log level, set environment property LOGGER_LEVEL to the desired log level.

  • LOGGER_LEVEL=info (enables info, warn and error) or

  • LOGGER_LEVEL=warn (enables only warn and error)

Usage examples

const console = require('console-server');

console.debug('oh, my');

console.info('just some information from our fellows...');

console.warn('there is a clif just a few steps fr...');

console.error('we couldn\'t advise that poor guy along the clif in time...');

Output:

demo1

Current Tags

  • 1.0.9                                ...           latest (2 years ago)

9 Versions

  • 1.0.9                                ...           2 years ago
  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (7)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |