1.0.3 • Published 6 months ago

pretty-node-logs v1.0.3

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

License

About The Project

The motivation for this project is to offer a simple solution to printing well formatted and more informative console messages at ease, offering a better experience while developing nodejs apps.

Installation

npm install --save-dev pretty-node-logs

yarn add --dev pretty-node-logs

Usage

Default Configuration

// ESM
import NodeLogger from 'pretty-node-logs';
// CJS
const NodeLogger = require('pretty-node-logs');

const logger = new NodeLogger();
defaultLogger.print('black', 'green', 'Custom colored print');

logger.print()

logger.log('This is a log');
logger.log('foo', 'bar');

logger.log()

logger.warn('This is a warning');
logger.warn('foo', 'bar');

logger.warn()

logger.error('This is an error');
logger.error('foo', 'bar');

logger.error()

logger.info('For your information');
logger.info('foo', 'bar');

logger.info()

logger.success('This is a success');
logger.success('foo', 'bar');

logger.success()

logger.debug('This is a debugging message');
logger.debug('foo', 'bar');

logger.debug()

logger.assert('This is an assertion');
logger.assert('foo', 'bar');

logger.assert()

Custom Configuration

PropertyTypeDefault
useIconsbooleantrue
useTimestampgroupbooleansinglebooleangroupfalsesinglefalse
groupTitleslogstringwarningstringerrorstringinfostringsuccessstringdebugstringassertionstringlog"LOGS"warning"WARNINGS"error"ERRORS"info"INFORMATION"success"SUCCESS"debug"DEBUG"assertion"ASSERTIONS"
const logger = new NodeLogger({
  useIcons: false,
  useTimestamp: { group: true, single: true },
  groupTitles: {
    log: 'custom log title',
  },
});

logger.assert()

Contact

1.0.3

6 months ago

1.0.2

6 months ago