Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

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

install

npm i xnpmlog

Downloadsweekly downloads

7

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability