JSPM

node-colorful-logger

1.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q29948F
  • License ISC

A simple logger with colors & timestamp, without dependencies.

Package Exports

  • node-colorful-logger
  • node-colorful-logger/build/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-colorful-logger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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