@firstfleet/fflogger
This is a centralized logger that sends logs to papertrail (or any syslog system, you just need to set your host and port) and to the console when process.env.NODE_ENV is not production
This logger is hardcoded for udp, if you want to use a more generic syslog, check out @firstfleet/ffsyslog. Its a modified version of winston-syslog. It adds colors and better formatting,
breaking apart multiline messages like stack traces for better readability.
This package requires winston and winston-papertrail. In order to send logs to paper trail, you must set
define your options in process.env variables
{
PAPERTRAIL_HOST: "host", --no default
PAPERTRAIL_PORT: 8080, --no default
PAPERTRAIL_PROGRAM: "program-name", --defaults to "default"
PAPERTRAIL_HOSTNAME: "host machine", -- defaults to os.hostname()
}
If the papertrail config is not setup the papertrail transport will not be created. At minimum you need
a host and port.
If you update the JS Docs you can rebuild the documentation by running
npm run build-docs
To publish to npm
- Increment the package version
- Login by running
npm login
- Make sure you have been added to the firstfleet org
- run
npm run send
Example
const logger = require('./ffLogger');
logger.log('info', 'test info log');
logger.info('test info log');
logger.debug('debug level log');
logger.error('error message', error);