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

Was this helpful?

  1. Configuration

formatStamp

You might want to define your own stamp style, for those occasions you can overwrite the default stamp formatting function:

require('better-logging')(console, {
  formatStamp: content => `<${content}>`
});

console.debug('foo'); // <11:46:35.294> <debug> foo
console.log('foo'); //   <11:46:35.295> <log> foo
console.info('foo'); //  <11:46:35.296> <info> foo
console.warn('foo'); //  <11:46:35.297> <warn> foo
console.error('foo'); // <11:46:35.298> <error> foo
PreviousformatNextsaveToFile

Last updated 3 years ago

Was this helpful?