-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,25 @@ | ||
![Serama](../serama.png) | ||
|
||
# Logger | ||
# Logging | ||
|
||
## Overview | ||
|
||
This module exposes three methods - | ||
|
||
`debug` | ||
|
||
`stage` | ||
|
||
`prod` | ||
|
||
Depending on the level specified in the config.json file, calls to these messages either log to the file system, or do nothing. | ||
|
||
## Configuration | ||
|
||
``` | ||
"logging": { | ||
"enabled": true, | ||
"level": "DEBUG", | ||
"path": "./log", | ||
"filename": "dadi-api", | ||
"extension": "log", | ||
"dateFormat": "", | ||
"messageFormat": "<%= label %> - <%= date %> - <%= message %>" | ||
"extension": "log" | ||
} | ||
``` | ||
|
||
## Levels | ||
|
||
* 'DEBUG' - most verbose, all logging is persisted | ||
* 'STAGE' - medium logging, calls to `stage`, and `prod` are persisted. Calls to `debug` are ignored | ||
* 'PROD' - least amount of logging, only calls to `prod` are persisted. All others are ignored | ||
|
||
## Example Usage | ||
|
||
`var logger = require('./dadi/lib/log');` | ||
|
||
`logger.debug('debug message');` | ||
``` | ||
var Log = require('dadi-api').Log; | ||
`logger.prod('message for production');` | ||
var logger = Log.get().child({module: 'your module name'}); | ||
logger.info('your log message'); | ||
``` |