Skip to content

okunokentaro/cw-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#cw-log

Build Status

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 instance
  • t(): string - The ISO timestamp

Logger instance

  • trace(...args)
  • debug(...args)
  • info(...args)
  • warn(...args)
  • error(...args)
  • fatal(...args)
  • t(): string - an alias of static t()

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

License

MIT

About

A simple and level controllable logger.

Resources

License

Stars

Watchers

Forks

Packages

No packages published