0.0.14 • Published 8 years ago
@hke/debug v0.0.14
@hke/debug
What is @hke/debug?
@hke/debug
is a little wrapper module for console.log()
. Depending on the verbose- and log-level it prints and/or saves all logs passed to debug.log()
.
How to use
Include @hke/debug
in your code.
@hke/debug
comes with three kinds of log types and two destinations to log.
The log types/levels are 0 = INFO
, 1 = WARNING
, 2 = ERROR
.
The two different destitinations are the console and, depending on the platform used, the file system or localstorage/indexeddb. Where and which logs are displayed or saved is managed with the loglevel
(DEFAULT = 2
) and verbose
(DEFAULT = 1
) properties.
var debug = require('@hke/debug');
// some code
console.log(debug.level); // 2
console.log(debug.verbose); // 1
debug.log('information'); // won't do anything
debug.warn('warning'); // prints 'warning'
debug.error('error'); // prints 'error' and saves
debug.setVerbose(2); // only errors will be printed
debug.setLevel(0); // severything will be saved
// more code