Jogger
A Javascript logger.
Description
Jogger is a Javascript logger which can be used in both browsers and Node.js applications.
- Formatted messages (printf like).
- Colored messages (Node.js only).
- Output messages depending on the log level.
- Output messages depending on a filter.
- Update level and filter on running app.
Installation
$ npm install jogger
Usage
var Jogger = ;var Log = colorize: false // color messages under Node.js if true filter : null // a RegExp object used to filter messages level : JoggerLevelw // will output errors and warnings only outputs : // will output to stdout and "LOG" file processstdout port : 3737 // optional, will listen to the specified port, see below; Log;Log;Log;Log; // change log level:Loglevel = JoggerLeveld; // update the filter:Logfilter = /Tag/;
Change level and filter attributes from outside
Be sure to pass the "port" option when instancing the Jogger object.
# change log level: echo 'level d' | nc localhost 3737 # change the filter: echo 'filter Tag' | nc localhost 3737
Log levels
- 0 Jogger.Level.none: Will not output any messages.
- 1 Jogger.Level.e : Will output errors.
- 2 Jogger.Level.w : Will output errors and warnings.
- 3 Jogger.Level.i : Will output errors, warnings and infos.
- 4 Jogger.Level.d : Will output errors, warnings, infos and debugs.
Git repository
https://github.com/francoiscolas/jogger
License
MIT license
Copyright (C) 2011 by François Colas francoiscolas@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.