node-custom-logger

1.0.2 • Public • Published

initailize

  const logger = require('node-custom-logger');
  const print = (data) => {
    console.log(data);
  };
  const cbList = {
    trace: console.log,
    debug: console.log,
    info: console.log,
    warning: print,
    error: print,
    fatal: print,
  };
  const commonContents = { common: 'common message', };
  logger.initialize(cbList, commonContent);

logging

  logger.error({ code: 999, message: 'error message' });

output

{
  level: 'error',
  timestamp: 1705037099205,
  content: { common: 'common message', code: 999, message: 'error message' }
}

Readme

Keywords

Package Sidebar

Install

npm i node-custom-logger

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

2.4 kB

Total Files

3

Last publish

Collaborators

  • kyungchan