Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msteckyefantis/loglevels
log with many levels (100% code coverage, baby)
https://github.com/msteckyefantis/loglevels
baby color colour easy easy-to-use fast log logger logging loglevel loglevels no-dependencies node node-js nodejs npm npm-module npm-package quickstart simple
Last synced: 8 days ago
JSON representation
log with many levels (100% code coverage, baby)
- Host: GitHub
- URL: https://github.com/msteckyefantis/loglevels
- Owner: msteckyefantis
- License: bsd-3-clause
- Created: 2016-12-02T05:01:07.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-19T13:59:48.000Z (over 5 years ago)
- Last Synced: 2024-10-29T22:26:05.710Z (3 months ago)
- Topics: baby, color, colour, easy, easy-to-use, fast, log, logger, logging, loglevel, loglevels, no-dependencies, node, node-js, nodejs, npm, npm-module, npm-package, quickstart, simple
- Language: JavaScript
- Homepage:
- Size: 78.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LogLevels [![npm version](https://badge.fury.io/js/loglevels.svg)](https://badge.fury.io/js/loglevels) [![Build Status](https://travis-ci.org/msteckyefantis/loglevels.svg?branch=master)](https://travis-ci.org/msteckyefantis/loglevels)
## About:
Sensual, single file, no dependency, colour logger. Just for you baby🐬.## install:
```
npm install loglevels
```## usage:
```.js
'use strict';/* On-Switch (special environment variable): */
process.env.LOG_LEVELS_ON_FOR_COMPONENTS = 'component_a component_b component_c';/* regular environment variables: */
// process.env.ROOT_LOGGER_PATH = 'music_app';
// process.env.LOG_LEVELS = 'debug warn critical';
// process.env.LOGGER_COLOUR_OFF = 'true';const component = 'component_b';
const logger = require( 'loglevels' ).setLocationAndGetLogger( __filename, component );
logger.debug( 'your message here' );
logger.info( 'your message here' );
logger.warn( 'your message here' );
logger.error( 'your message here' );
logger.critical( 'sexy monkey' );
```#### This code sample logs the following:
(`__filename` in this example is `'/Users/michaelstecky-efantis/music_app/loglevels/music_app/loglevelsTest.js'`)
![alt text](https://s3.amazonaws.com/mega-monkey/withoutenv.png)#### With all the regular environment variables uncommented, the code sample above logs the following:
![alt text](https://s3.amazonaws.com/mega-monkey/withenv.png)