2.0.0 • Published 9 years ago

xnpmlog v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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:

NameTypeDescription
loglevelStringSet the log level (info)
prefixStyleObjectSet prefix style ({ fg: 'magenta' })
headingStyleObjectSet heading style ({ fg: 'white', bg: 'black' })
streamStreamThe stream (process.stderr)
timestampBooleanInclude timestamp in logs (true)
headingStringThe log heading ('')
Params
NameType(s)Description
componentStringThe component
optsObjectThe opts

Logger.createLogger()

Creates a logger

Example

var Logger = require('xnpmlog')
var log = Logger.createLogger('test')
Params
NameType(s)Description
compStringThe component
optsObjectThe opts

Logger.child()

Creates a child logger

Example

var logger = require('xnpmlog')('app')
var log = logger.child('users-controller')
Params
NameType(s)Description
compStringThe component
optsObjectThe opts

Logger.pause()

Pauses the log stream


Logger.resume()

Resumes the log stream


Logger.rmLevel()

Removes the given log level

Params
NameType(s)Description
levelStringThe log level to remove

Logger.addLevel()

Adds a new log level

Params
NameType(s)Description
levelStringThe log level
nNumberThe numeric level
styleObjectThe ansi style object
dispStringOptional replacement for level in the output

2.0.0

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.0.1

10 years ago