detailed-logger

0.0.6 • Public • Published

detailed-logger

DetailedLogger logs the console methods to the terminal and color codes them. Most importantly, the filename and line number is included for faster debugging.

Import or Require

ESM:

import DetailedLogger from 'detailed-logger';

CommonJS:

const DetailedLogger = require('detailed-logger');

Initialization and Usage

const logger = new DetailedLogger();

logger.trace('trace');
logger.debug('debug');
logger.log('log');
logger.info('info');
logger.warn('warn');
logger.error('error');

Screenshot 2022-08-05 at 7 55 09 AM

Trace is at the highest log level and error is at the lowest. Use setLevel to adjust logging detail.

logger.setLevel('trace');  // all log messages are emitted

For less detail:

logger.setLevel('warn');  // only warn and error messages are emitted

For info, warn, and error:

logger.setLevel('info');

Note that 'info' is the default.

Run the examples in the examples folder for more in-depth understanding.

License

Copyright (c) James Mortensen, 2021-2022 MIT License

Package Sidebar

Install

npm i detailed-logger

Weekly Downloads

171

Version

0.0.6

License

MIT

Unpacked Size

3.58 kB

Total Files

4

Last publish

Collaborators

  • jmort253