node-colorful-logger
v1.3.0
Published
A simple logger with colors & timestamp, without dependencies.
Downloads
5
Maintainers
Readme
node-colorful-logger
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 :