#cw-log
cw-log
is a simple and level controllable logger.
$npm install cw-log --save
For node.
var log = require('cw-log').logger(6);
For a browser. (use /lib/log.js
)
<script src="/path/to/log.js"></script>
var log = cwlog.logger(6);
Usage.
log.trace('the message');
log.fatal('a serious notice');
log.trace(cwlog.t(), 'with a timestamp', 42, {key: 'multiple arguments'});
static cwlog
logger(level: number\[0-6\])
: Logger instancet()
: string - The ISO timestamp
Logger instance
trace(...args)
debug(...args)
info(...args)
warn(...args)
error(...args)
fatal(...args)
t()
: string - an alias of statict()
such as Log4j.
- 0: OFF
- 1: FATAL
- 2: ERROR
- 3: WARN
- 4: INFO
- 5: DEBUG
- 6: TRACE
When you use dtsm, you can paste the following to dtsm.json
and edit ref
.
"cw-log/cw-log.d.ts": {
"repo": "https://github.com/armorik83/cw-log.git",
"ref": [latest commit hash],
"path": "cw-log.d.ts"
}
- OKUNOKENTARO aka armorik83
MIT