1.1.1 • Published 5 years ago
log-config v1.1.1
Log Config
A simple preconfigured logger.
Installation
npm i --save log-config
Use
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 theLogLevel
valuesNODE_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 tolocal0
SYSLOGD_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:
ALERT
CRIT
orCRITICAL
ERROR
WARN
orWARNING
NOTICE
INFO
DEBUG
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.