@mobilabs/kzlog
v1.0.4
Published
A minimal lightweight logging library for JavaScript
Downloads
54
Readme
KZlog
KZlog is a minimal lightweight logging library in Javascript that runs on the browser and on Node.JS.
Quick Startup
// name {String}: the name of the module/library,
// level {String}: the threshold level,
// highlight {Boolean}: log message printed in color or B&W,
const log = KZlog(name, level, highlight);
log.warn(message);
// output: [2019-4-17 18:39:37:357] [error] name: aaaa
API
Methods
KZlog provides the following methods:
| Methods | Description | |:---------------------|:------------| | help | dumps, to the console, the on-line | | version | returns the version of the library | | setName | updates the name of the module/library to be displayed | | setLevel | updates the threshold level | | setHighlight | updates the highlight mode | | trace | dumps a trace message | | debug | dumps a debug message | | info | dumps a info message | | warn | dumps a warn message | | error | dumps a error message | | fatal | dumps a fatal message |
Threshold level
The default threshold level is trace
. It can be set to trace
, debug
, info
, warn
, error
, fatal
or off
.
License
MIT.