@alexrah/logger
v5.2.0
Published
console.log wrapper with log level, stack trace and coloured output
Downloads
22
Maintainers
Readme
DISCLAIMER: not ready for production releases
logger - A simple console.log wrapper
Intallation
npm i @alexrah/logger
Features
- custom prefix when creating instance
const lg = new logger('custom prefix')
- random coloured output
- stack trace with
const lg = new logger(); lg.s('traced output'')
Requirements NODE environment
- create a .env file in the root directory
- add constant
LOG_LEVEL
with a value between 1 and 6LOG_LEVEL="6"
Requirements BROWSER environment
- create a global object env
window.env = {}
- add constant
LOG_LEVEL
with a value between 1 and 6window.env.LOG_LEVEL = '6';
LOG_LEVEL
ASSERT = 1;
ERROR = 2;
WARN = 3;
INFO = 4;
DEBUG = 5;
VERBOSE = 6
TODO
- global setLevel with dotenv
- now works only with window.console, add support to node console
- testing: add jest deps and write tests