nhsuk-bunyan-logger
v1.13.0
Published
Facade over bunyan logger.
Downloads
65
Readme
NHSUK Bunyan logger
A little library to ease the sharing of the setup of the bunyan
logger.
An instance of a bunyan
logger is created via the
constructor-api and
returned.
Install
- A specific release version (recommended). e.g via yarn:
yarn install git://github.com/nhsuk/bunyan-logger.git#x.x.x
- The latest version (not recommended). e.g. via npm:
npm install nhsuk/bunyan-logger
- Any of the other ways to install an npm package
Usage
const log = require('nhsuk-bunyan-logger')('LOGGER-NAME');
log.METHOD('message goes here');
Where LOGGER-NAME
is the name you want for the logger.
Where METHOD
is any of the supported Bunyan
logger methods. Check
out the Bunyan documentation for
additional information on the API.
Environment Variables
A number of environment variables are used, as detailed below.
| Variable | Description | Default |
|:------------|:------------------------------------------------------------------|:----------------------|
| NODE_ENV
| Node environment | development |
| LOG_LEVEL
| Numeric log level | Depends on NODE_ENV
|
A note on LOG_LEVEL
- there are default values set depending on the
environment. However, if LOG_LEVEL
is set this value will override any
defaults there might be.