Skip to content

justmoon/riverpig

Folders and files

NameName
Last commit message
Last commit date
Oct 22, 2016
Oct 28, 2016
Oct 22, 2016
Jun 28, 2018
Jan 3, 2018
Oct 22, 2016
Oct 22, 2016
Oct 22, 2016
Oct 28, 2016
Jan 3, 2018
Jan 3, 2018
Oct 22, 2016
Oct 22, 2016

Repository files navigation

Riverpig

npm CircleCI Codecov

Simple downstream log driver for twelve-factor apps

Picture of log drivers

Why?

We wanted a simple logger that logs to stdout and works well with debug.

Features

  • Integrates with debug
  • Same log levels as Console: info, warn, error
  • Can log callsites (file, line number where log method was called)

Usage

Use debug to add logging to your libraries. In your main application add riverpig:

npm install --save riverpig

And then add logging to each module like so:

const logger = require('riverpig')('mymodule')

logger.info('module loaded')
logger.warn('reaching the end of the module')
logger.error('module actually does not do anything')

Environment config

RIVERPIG_LINEINFO

Log the file and line where the log method was called. Disabled by default for performance.

Possible values:

  • smart, 1 or true - Let Riverpig select the most useful formatting for callsite information.
  • long - Log the full, absolute path.
  • short - Log the absolute path, with folder names truncated to one character, e.g. /u/l/b/example.js
  • fileonly - Log only the file name without path.