0.0.1 • Published 8 years ago
torchfi-logger v0.0.1
This is a wrapper for logger just like what sl4j/commons-logging is for java. Currently it simply calls console.log & equivalent with a log format. But going ahead it should be a facade for logging system like winston.
Usage:
const Logger = require('torch-looger'); const logger = new Logger('example.js');
try { const statement = "js statement";
logger.debug('calling eval() on %s', statement);
/* Will print following to stdout
[2016-03-08 19:13:06.286] DBG example.js: calling eval() on js statement */
eval(statement);
} catch (e) {
logger.error("Caught error while calling eval() on %s", statement, e);
/* Will print following to sderr
* [2016-03-08 19:13:06.291] ERR example.js: Caught error while calling eval() on js statement
* SyntaxError: Unexpected identifier
* at Object.<anonymous> (example.js:9:10)
* at Module._compile (module.js:410:26)
* at Object.Module._extensions..js (module.js:417:10)
* at Module.load (module.js:344:32)
* at Function.Module._load (module.js:301:12)
* at Module.runMain [as _onTimeout] (module.js:442:10)
* at Timer.listOnTimeout (timers.js:92:15)
*/
}
0.0.1
8 years ago