1.1.1 • Published 5 years ago

log-config v1.1.1

Weekly downloads
2
License
BSD-3-Clause
Repository
github
Last release
5 years ago

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 the LogLevel values
  • NODE_ENV: the Node.JS environment (test, production, etc.)

If winston-syslog is installed, you may supply too:

  • HOST: the application host, defaults to localhost
  • SYSLOGD_FACILITY: the Syslog facility, defaults to local0
  • SYSLOGD_HOST: the Syslogd host, defaults to localhost
  • SYSLOGD_PORT: the Syslogd port, defaults to 514/tcp

LogLevel

The LogLevel is an enumerator. The valid log level keys are:

  • ALERT
  • CRIT or CRITICAL
  • ERROR
  • WARN or WARNING
  • 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.

License

The 3-Clause BSD License

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago