Skip to content

CreativeFlume/cf-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cf-log

A Conditional Logger with Colored Labels for Node.js

A simple conditional logger for node.js. Each logging statement is configured with a title and message. You can optionally add a map of environment variables to check for prior to logging and label color.

Installation

npm install cf-log

Example Usage

import logger from 'cf-log';

logger.log({
  title: 'Request',
  message: 'Some cookies',
  env: {
    NODE_ENV: 'development',
    LOG_FEATURE: 'cookieJar'
  }
});

This block of code will log:

Request    Some cookies

when the environment variables NODE_ENV and LOG_FEATURE are set to their respective values. The env map may contain any arbitrary mapping of environment variables to values.

Colors

  1. logger.green (default)
  2. logger.red
  3. logger.blue
  4. logger.yellow

Imagery

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published