@openfin/simple-winston
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

simple-winston

Simple consistent logging.

npm i @openfin/simple-winston

Usage

simple-winston exposes a function that returns a winston logger. Its a simple wrapper on winston.loggers.get.

import makeLogger from 'simple-winston'
const logger = makeLogger("some-label", "warn", true);
logger.info("Hi we are logging!");

Arguments

idLabel:string

The label and internal winston id.

level:string

Valid values are: silly info debug warn error

Defaults to whatever is in NODE_DEBUG otherwise sets to debug. When this is set that logger will only output logs with a level higher or equal to. We reccomond setting the NODE_DEBUG environment variable instead of setting this yourself.

colorize:boolean

If the environment variable NODE_ENV is set to production this defaults to false otherwise its set to true.

NODE_DEBUG_ONLY

simple-winston also looks for the environemnt variable NODE_DEBUG_ONLY. This allows you to filter logs by label/id. Uses string.startsWith for matches, use commas to seperate labels. Example:

import makeLogger from 'simple-winston'
const loga = makeLogger("loga");
const logb = makeLogger("logb");
const someOtherLog = makeLogger("someOtherLog");
loga.info("I will get logged")
logb.info("I will also get logged");
someOtherLog.info("I will be sileneced");
==============
NODE_DEBUG_ONLY=log node test.js

Can be combined with NODE_DEBUG to limit levels as well as ids.

Format

Logs are always in this format. <ISO string> - <level>: [<label>] ...your-text

Readme

Keywords

none

Package Sidebar

Install

npm i @openfin/simple-winston

Weekly Downloads

1

Version

2.0.0

License

MIT

Last publish

Collaborators

  • ameet-openfin
  • jmransegnola
  • marek_openfin
  • yoge-openfin
  • nil.ffej
  • gilesstevenson-openfin
  • eheyder
  • newaz.sharif
  • efraim-herstic
  • royhafin
  • openfincolinhu
  • openfin-johans
  • alan15008
  • openfin-ci-gh
  • hina-khalid
  • ife-dev1
  • mjosling
  • elliott.burr
  • vsaw3
  • gallak-openfin
  • galim.kaudinov
  • hzhi0209
  • andy.westacott
  • __tomasz__
  • cameronopenfin
  • jennrondeau
  • dhilan
  • benstubbington
  • davidcoxon-of
  • openfin-jeff
  • gouthamc
  • hannahmcmillen
  • xyopenfin
  • smocarski
  • eugeneross-openfin
  • imansuri
  • manamiueda
  • sakibahmad
  • shahossain
  • openfinbrandon
  • pierrebaize
  • noyangunday
  • michaelmcoates
  • johnmandia-openfin
  • rdepena
  • tgoc99
  • wenjunche
  • harsimran.openfin.singh
  • luiemilio
  • licui3936
  • connormccafferty
  • adam.saland
  • openfin-ci
  • chrishobsonexpero
  • richbrowne-openfin
  • azizyok
  • openfin-gavin
  • oblarg