Better Logging
  • Introduction
  • Setup
    • Install
    • Log Levels
  • Configuration
    • format
    • formatStamp
    • saveToFile
    • logLevels
    • color
    • messageConstructionStrategy
  • extra
    • Decorate Arbitrary Object
    • Custom Instance
    • Express Middleware
    • Typescript Support
  • Upgrade Guides
    • 4.x to 5.x
    • 3.x to 4.x
Powered by GitBook
On this page
  1. Configuration

logLevels

PrevioussaveToFileNextcolor

Last updated 3 years ago

Was this helpful?

CtrlK

Was this helpful?

Some times the default log levels might not fit your needs, in those cases you can redefine the log levels to anything you like.

require('better-logging')(console, {
  logLevels: {
    debug: 0,
    error: 10,
    info: 10,
    line: 10,
    log: 10,
    warn: 10,
  }
});

console.debug('foo'); //  [11:46:35.294] [debug] foo
console.log('foo'); //    wont print
console.info('foo'); //   wont print
console.warn('foo'); //   wont print
console.error('foo'); //  wont print
console.line('foo'); //   wont print