Skip to content

Higink/colored-function-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Colored Function Logger

0 dependencies

A very light logging utility that automatically displays the calling function name with unique colors for Node.js and browser with no dependencies.

Preview

Features

  • Automatic calling function name detection
  • Automatic color generation based on function name
  • Work same as native console methods
  • Environment detection (Node.js/Browser)
  • All log levels (log, info, warn, error, debug)
  • 0 dependencies

Installation

npm install colored-function-logger

Usage

There are two examples in the DEMO folder, one for Node.js and one for browser.

import logger from 'colored-function-logger';

function yourFunction() {
    logger.log('This is a standard log');
    logger.warn('But you can use the others log levels too!');
}

Color Features Details

Browser: 16M colors, convert function name to hexadecimal color.
Node.js: 256 colors, convert function name to the closest ANSI color or fallback to 8 basic colors.

License

This project is licensed under CC BY-NC-SA.

CC BY-NC-SA

About

A very light logger that automatically displays the calling function name with colors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published