npm.io
1.3.1 • Published 4 years ago

@zaneray/express-logging

Licence
—
Version
1.3.1
Deps
3
Size
46 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

ZaneRay Express Logging

  • A wrapper around Winston
  • Supports logging to Google StackDriver for deployed applications

Definitions

Environments

  • development
  • test
  • staging
  • prod
Transports (transports.js)
  • defines where to log in each Environment
Options (options.js)
  • defines how to log in each Environment
Log Levels - from Winston
  • 0: error
  • 1: warn
  • 2: info
  • 3: verbose
  • 4: debug
  • 5: silly

Usage (see test/loggingTest.js)

in your environment

npm install --save @zaneray/express-logging

in your code.js

const logging = require("@zaneray/express-logging");

// set process.env.NODE_ENV in the runtime
// logger level and output method is determined by environment (see transports.js and options.js)
const logger = logging.create();

// Writes some log entries
logger.info("here's some information");
logger.warn("something might be wrong");
logger.error("something is wrong, seriously");

//change log level to log warn and above
logging.setLevel("warn");
//show the current level
logger.warn(logging.getLevel());

// Writes some log entries
logger.info("here's some information");
logger.warn("something might be wrong");
logger.error("something is wrong, seriously");