xnpmlog

2.0.0 • Public • Published

xnpmlog

Build Status Coverage Status

npmlog with the ability to create child loggers

xnpmlog only works on iojs and node v4+. To use xnpmlog with node 0.10 or 0.12, install xnpmlog@1.

Author

Evan Lucas

License

MIT

Installation

$ npm install --save xnpmlog

Tests

$ npm test

Coverage

$ npm run cover

API

Logger

Constructor

opts can contain:

Name Type Description
loglevel String Set the log level (info)
prefixStyle Object Set prefix style ({ fg: 'magenta' })
headingStyle Object Set heading style ({ fg: 'white', bg: 'black' })
stream Stream The stream (process.stderr)
timestamp Boolean Include timestamp in logs (true)
heading String The log heading ('')
Params
Name Type(s) Description
component String The component
opts Object The opts

Logger.createLogger()

Creates a logger

Example

var Logger = require('xnpmlog')
var log = Logger.createLogger('test')
Params
Name Type(s) Description
comp String The component
opts Object The opts

Logger.child()

Creates a child logger

Example

var logger = require('xnpmlog')('app')
var log = logger.child('users-controller')
Params
Name Type(s) Description
comp String The component
opts Object The opts

Logger.pause()

Pauses the log stream


Logger.resume()

Resumes the log stream


Logger.rmLevel()

Removes the given log level

Params
Name Type(s) Description
level String The log level to remove

Logger.addLevel()

Adds a new log level

Params
Name Type(s) Description
level String The log level
n Number The numeric level
style Object The ansi style object
disp String Optional replacement for level in the output

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    8
    • latest

Version History

Package Sidebar

Install

npm i xnpmlog

Weekly Downloads

9

Version

2.0.0

License

MIT

Last publish

Collaborators

  • eh
  • evanlucas