node-colorful-logger
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

node-colorful-logger

Coverage Stars NPM

A simple logger with colors & timestamp, without useless dependencies.

Installation

npm i node-colorful-logger

Usage

Logger which write logs to stdout

const logger = new Logger();

Below example create a logger which write logs in stdout/err and in log files ('./app.log')

import { Logger } from 'node-colorful-logger';
const logger = new Logger(process.cwd() + '/app');

logger.info('Info log');
logger.success('Success log');
logger.error('Error log');
logger.warn('Warn log');
logger.debug('Debug log (without debug mode');
logger.enableDebugMode();
logger.debug('Debug log (with debug mode');
logger.disableDebugMode();

output :

20/11/2022, 12:02:00 - INFO - Info log         //stdout
20/11/2022, 12:02:00 - SUCCESS - Success log   //stdout
20/11/2022, 12:02:00 - ERROR - Error log      //stderr
20/11/2022, 12:02:00 - WARN - Warn log        //stdout
20/11/2022, 12:02:00 - DEBUG - Debug log (with debug mode) //stdout

With colors :

Colorful output

Package Sidebar

Install

npm i node-colorful-logger

Weekly Downloads

2

Version

1.3.0

License

ISC

Unpacked Size

9.65 kB

Total Files

6

Last publish

Collaborators

  • 6ela