logxx
v0.0.1
Published
A simple logger that just work.
Downloads
2
Readme
logxx
A simple logger that just work.
Features:
- no dependency.
- configurable log levels.
- configurable appender. such as stdout, file and all writable streams.
Installation
$ npm install logxx -S
Usage
var logxx = require('logxx');
logxx.info('Something');
By default, logxx will output logs to stdout.
Document
logxx
It is a predefined 'standard' Logger accessible through helper functions, which are easier to use than creating a Logger manually.
| property | default value | |:----------|:-----------------| | log level |
logxx.L_INFO
| | output |process.stdout
|log level
| log level | description | |:------------------|:-------------------------------| |
logxx.L_SILENCE
| output nothing | |logxx.L_ERROR
| outputerror
only | |logxx.L_INFO
| output botherror
andinfo
|creates a new logger
Function:
logxx.newLogger(level, output)
The
level
variable sets the log level. value:logxx.L_SILENCE
,logxx.L_ERROR
,logxx.L_INFO
default:logxx.L_INFO
The
output
variable sets the destination to which log data will be written. type:streams.Writable
, default:process.stdout
.more functions
| functions | description | |:-------------------------|:-----------------------| |
logxx.info(anything)
| output normal message | |logxx.error(anything)
| output error message | |logxx.getLevel()
| return log level | |logxx.setLevel(level)
| set log level | |logxx.getOutput()
| return output appender | |logxx.setOutput(level)
| set output appender |
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
this repo is released under the MIT License.