Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

server-base-log

jameskyburz1.4kApache-2.07.1.32

server base log wrapper using pino

log server-base logging pino http

readme

server base pino logger

simple wrapper for pino used by server-base

js-standard-style build status downloads

usage

const log = require('server-base-log')(__filename, { optional pino options })

log.info('ok')

info, fatal, debug, error, trace and warn are bound to correct t.equal for convenience.

log options

All options are passed to pino

opt.pretty options are passed to pino.pretty constructor

default log options are

  safe: true,
  serializers: {
    req: pino.stdSerializers.req,
    res: pino.stdSerializers.res,
    q: pino.stdSerializers.req,
    r: pino.stdSerializers.res
  }
`

http request logging

Both log.info({ q, r }) and log.info({ req, res }) work.

env

setting process.env.LOG_PRETTY uses pino.pretty

setting process.env.LOG_LEVEL overrides the default log level which is debug

install

With npm do:

npm install server-base-log

license

Apache License, Version 2.0