1.1.1 • Published 6 years ago
log-config v1.1.1
Log Config
A simple preconfigured logger.
Installation
npm i --save log-configUse
import { LogLevel, logger } from 'log-config'
logger.log(LogLevel.INFO, 'simple log example', { /* some extra data */ })The logger object is just a winston.Logger.
Environment variables
APP_NAME: the application/service name (set on logs)LOG_LEVEL: one of theLogLevelvaluesNODE_ENV: the Node.JS environment (test,production, etc.)
If winston-syslog is installed, you may supply too:
HOST: the application host, defaults to localhostSYSLOGD_FACILITY: the Syslog facility, defaults tolocal0SYSLOGD_HOST: the Syslogd host, defaults to localhostSYSLOGD_PORT: the Syslogd port, defaults to 514/tcp
LogLevel
The LogLevel is an enumerator. The valid log level keys are:
ALERTCRITorCRITICALERRORWARNorWARNINGNOTICEINFODEBUG
Do not use EMERG, it’s just for internal use.
Logs output
By default, logs are shot into the console. If
winston-syslog is installed, logs go to Syslog.