pretty-node-logs
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

License

pretty-node-logs v1.0.0

A prettier way to print messages to your node console.


Table of Contents
  1. About The Project
  2. Installation
  3. Usage
  4. Contact

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.

[ back to top ]

Installation

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

yarn add --dev pretty-node-logs

[ back to top ]

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

Property Type Default
useIcons boolean true
useTimestamp
group boolean
single boolean
group false
single false
groupTitles
log string
warning string
error string
info string
success string
debug string
assertion string
log "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()

[ back to top ]

Contact

yoni@yondav.us

[ back to top ]

---

© Yoni David 2023

yondav.us

Readme

Keywords

none

Package Sidebar

Install

npm i pretty-node-logs

Weekly Downloads

0

Version

1.0.3

License

none

Unpacked Size

192 kB

Total Files

54

Last publish

Collaborators

  • yondav