4.2.0 • Published 6 years ago

kittie v4.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

kittie

Build Status

A fast, simple logger with children

Install

$ npm install [--save] kittie

API

log

A logger is exported. To use:

const log = require('kittie')
log.silly('hello')
log.verbose('hello')
log.info('hello')
log.http('hello')
log.warn('hello')
log.error('hello')

// to change the log level
log.level = 'silly'

// we also support child loggers
const debug = log.child('debug')
debug.level = process.env.DEBUG
  ? 'silent'
  : 'silly'

debug.info('Hey! This is a debug message')

Each logger has the following methods:

silly(message, meta)

Will only be logged if the logger's level is set to silly.

verbose(message, meta)

Will only be logged if the logger's level is set to silly or verbose.

info(message, meta)

Will only be logged if the logger's level is set to silly, verbose, or info.

http(message, meta)

Will only be logged if the logger's level is set to silly, verbose, info, or http.

warn(message, meta)

Will be logged unless the logger's level is set to silent or error.

error(message, meta)

Will be logged unless the logger's level is set to silent.

inspect(obj, depth)

log.inspect() is a bit different than the other log methods. It functions at the verbose log level, but calls util.inspect() under the hood.

child(component)

Creates a new child logger that inherits settings from it's parent. A child logger can be used to distinguish different modules inside a single project.

Examples

Check out the examples/ directory to see some examples

Log levels

  • silly
  • verbose
  • info (Default)
  • http
  • warn
  • error
  • silent

Test

$ npm test

TODO

  • Add better documentation

Author

Evan Lucas

License

MIT (See LICENSE for more info)

4.2.0

6 years ago

4.1.1

8 years ago

4.1.0

8 years ago

4.0.0

8 years ago

3.1.0-alpha

8 years ago

3.1.0

8 years ago

3.0.0

8 years ago

2.2.0

9 years ago

2.1.2

9 years ago

2.1.1

9 years ago

2.1.0

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago