npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-chroma-logger

v1.1.0

Published

A zero-dependency minimalist asynchronous Node.js chromatic logger

Downloads

6

Readme

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

| name | description | required | default | | :--- | :---------- | :-------- | :----- | | NODE_CHROMA_LOGGER_DISABLE_COLOR | Wether 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_FORMAT | Wether to disable showing date in the log format. Accepted values: true or 1. | | false | | NODE_CHROMA_LOGGER_DISABLE_SEVERITY_FORMAT | Wether to disable showing severity in the log format. Accepted values: true or 1. | | false | | NODE_CHROMA_LOGGER_SEVERITY | Logger severity selected. See logger severities. Higher severities, if any, are activated. | | trace |

Severities

Sorted by highest to lowest severity.

| severity | description | color | data stream | | :------- | :---------- | :---- | :---------- | | fatal | The service/app is going to stop or become unusable now. An operator should definitely look into this soon. | background light red | stderr | | error | Fatal for a particular request, but the service/app continues servicing other requests. An operator should look at this soon(ish). | red | stderr | | warn | A note on something that should probably be looked at by an operator eventually. | yellow | stderr | | info | Detail on regular operation. | cyan | stdout | | log | Detail on regular operation. Same severity rank as info. | default | stdout | | success | Detail on a successful operation. Same severity rank as info. | green | stdout | | debug | Anything else, i.e. too verbose to be included in info severity. | light magenta | stdout | | trace | Logging from external libraries used by the app or very detailed application logging. | dark gray | stdout | | disable | Logging is disabled. | none | none |

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.