minimal-logger
A minimal logger for Node and React Native
Features:
- Provides a default logger and a way to get named loggers.
- Works the same way as
console.<debug | error | info | log | trace | warn>
. - Supports turning individual logger on or off.
- No messing up with line numbers.
- No dependencies.
Usage
Install:
yarn add minimal-logger
Default logger:
; logger;
Named logger:
; ;
Enable and disable logger:
; logger = ;logger;logger;logger;
Notes
- Loggers will be disabled by default if
__DEV__
isfalse
orNODE_ENV
is notdev
ordevelopment
. - Multiple calls to
getLogger()
with the same name will always return a reference to the same Logger object. Therefore if you disable it in one file, it will disable all references to the same Logger.