Skip to content

matthewmueller/loo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loo

Minimalistic streaming logger with a layered transport and custom field support.

Uses the same output format as bole, so tools like bistre and garnish will work great.

Installation

npm i loo

Example

let log = require('loo')

// application logging
let app = log('app')

// direct everything to a papertrail stream
app.pipe(papertrail(creds))

// direct error & fatal levels to process.stderr
app.error.pipe(process.stderr)
app.fatal.pipe(process.stderr)

// postgres service logging
let postgres = app('postgres')

// log the postgres debug & info events to stdout
postgres.debug.pipe(process.stdout)
postgres.info.pipe(process.stdout)

let query = 'SELECT * FROM teams'
let client = Postgres(url)

// add custom fields
postgres.debug.fields({ client: client.id })

// log out with printf support
postgres.debug('running query %s', query)

Levels

  • trace: finer-grained informational events than the debug
  • debug: fine-grained informational events that are most useful to debug an application
  • info: informational messages that highlight the progress of the application at coarse-grained level
  • warn: potentially harmful situations
  • error: error events that might still allow the application to continue running.
  • fatal: very severe error events that will presumably lead the application to abort.

Tests

npm install
npm test

License

MIT

About

Minimal streaming logger with layered transport and custom field support

Resources

Stars

Watchers

Forks

Packages

No packages published