cw-log
v0.2.0
Published
A simple logger for console.
Downloads
3
Readme
#cw-log
cw-log
is a simple and level controllable logger.
$npm install cw-log --save
Example
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'});
API
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()
Logging level
such as Log4j.
- 0: OFF
- 1: FATAL
- 2: ERROR
- 3: WARN
- 4: INFO
- 5: DEBUG
- 6: TRACE
for TypeScript
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"
}
Author
- OKUNOKENTARO aka armorik83
License
MIT