Minimal streaming logger with layered transport and custom field support
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.
npm i loo
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)
npm install
npm test
MIT