Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-chroma-logger

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-chroma-logger

A zero-dependency minimalist asynchronous Node.js chromatic logger

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

node-chroma-logger

colors

Table of Contents

Presentation

A zero-dependency minimalist asynchronous Node.js chromatic logger. When you want colors, don't want to use mainly synchronous logging methods of Console and get rid of a complex logger.

Installation

npm install --save node-chroma-logger

Technical information

Stack

  • Language: JavaScript ES6/ES7
  • Node.js >= Dubnium (10.22.1)

Code quality

Code style follows Airbnb JavaScript Best Practices using ESLint.

Tests

Mocha and Chai for unit testing.

Security

  • Code security and most precisely module dependencies can be audited running npm audit.

Requirements

Usage

Environment variables

namedescriptionrequireddefault
NODE_CHROMA_LOGGER_DISABLE_COLORWether to disable setting color (escape sequences). It is especially needed if the terminal does not have the feature to display colors at all or you just don't want any color. It is always set to false so that terminals that are not detected as able to display colors like for Gitlab CI pipelines for an example can always have colors displayed. Accepted values: true or 1.false
NODE_CHROMA_LOGGER_DISABLE_DATE_FORMATWether to disable showing date in the log format. Accepted values: true or 1.false
NODE_CHROMA_LOGGER_DISABLE_SEVERITY_FORMATWether to disable showing severity in the log format. Accepted values: true or 1.false
NODE_CHROMA_LOGGER_SEVERITYLogger severity selected. See logger severities. Higher severities, if any, are activated.trace

Severities

Sorted by highest to lowest severity.

severitydescriptioncolordata stream
fatalThe service/app is going to stop or become unusable now. An operator should definitely look into this soon.background light redstderr
errorFatal for a particular request, but the service/app continues servicing other requests. An operator should look at this soon(ish).redstderr
warnA note on something that should probably be looked at by an operator eventually.yellowstderr
infoDetail on regular operation.cyanstdout
logDetail on regular operation. Same severity rank as info.defaultstdout
successDetail on a successful operation. Same severity rank as info.greenstdout
debugAnything else, i.e. too verbose to be included in info severity.light magentastdout
traceLogging from external libraries used by the app or very detailed application logging.dark graystdout
disableLogging is disabled.nonenone

Import

const logger = require('node-chroma-logger');

Lib

  • logger <Object> with the following properties.
fatal
  • fatal(args) <Function>
    • args <Any>

Example:

logger.fatal('this was fatal, this has to stop!');
error
  • error(args) <Function>
    • args <Any>

Example:

logger.error('this was an error!', new Error('bad stuff'));
warn
  • warn(args) <Function>
    • args <Any>

Example:

logger.warn('ooooooops, be careful');
info
  • info(args) <Function>
    • args <Any>

Example:

logger.info('this is so helpful thanks');
log
  • log(args) <Function>
    • args <Any>

Example:

logger.log('log is at same level as info but without any specific color');
success
  • success(args) <Function>
    • args <Any>

Example:

logger.success('same as above, let\'s go!!');
debug
  • debug(args) <Function>
    • args <Any>

Example:

logger.debug({ hello: 'world' }, 'hi', 'this is just to have this info with some more details');
trace
  • trace(args) <Function>
    • args <Any>

Example:

logger.trace('this is a very detailed log', { details: 100 }, ['details', 'details']);

Errors

None.

Development

Linting

npm run lint

Unit test

npm test

Known issues

/

Code of Conduct

This project has a Code of Conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

Contributing

Please take a moment to read our Contributing Guidelines if you haven't done so yet.

Support

Please see our Support page if you have any questions or for any help needed.

Security

For any security concerns or issues, please visit our Security Policy page.

License

MIT.

Keywords

FAQs

Package last updated on 17 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc