flogger-log
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "flogger-log", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A ready to use - zero conf - logger", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -23,3 +23,3 @@ # Flogger | ||
You can change log levels (defaults are **debug**, **info**, **warning** and **error**) and how events are recorded passing options to Flogger constructor. | ||
The FileRenderer renderer, which saves events to file, is shipped with this package. | ||
The FileRenderer renderer, which saves events to file, is shipped with this package. | ||
@@ -51,3 +51,14 @@ ```javascript | ||
## You can write your custom renderer too | ||
## Methods | ||
Every log level name will have a corresponding method exposed by the flog object. Calling one of these function will results in a corresponding log record to be stored by the renderer (according to your current log level). | ||
The methods are named '$' followed by the log level name and accept log data as the only argument. | ||
example: | ||
`flog.$debug(<data>)` for 'debug' | ||
`flog.$foo(<data>)` for 'foo' | ||
The special method `log(levelName, data)` can be use in place of the '$' methods. It accepts the log level name as the first argument and the log data as the second argument. | ||
## You can write your custom renderer | ||
A flogger renderer is just a object exposing a "render" function. | ||
@@ -71,2 +82,4 @@ The render function will receive three parameters, the level name, the origin of the event and the data passed to the log function. | ||
## Advanced renderers | ||
More advanced renderers could be written as classes accepting parameters in their constructors for fine-grained customization. | ||
@@ -73,0 +86,0 @@ |
45442
108