better-logs
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -207,5 +207,4 @@ var _ = require('lodash'); | ||
var _refreshMorgan = function (opts) { | ||
opts = Object.assign(opts || {}, { | ||
stream: _getOutputStream('morgan', 'morgan') | ||
}); | ||
opts = opts || {}; | ||
opts.stream = _getOutputStream('morgan', 'morgan') | ||
morgan.token('datefmt', function () { | ||
@@ -212,0 +211,0 @@ return datefmt(new Date(), _display.dateformat); |
{ | ||
"name": "better-logs", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Really flexible and fast logger for web servers, applications and daemons", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -102,3 +102,3 @@ Even Better Logs for NodeJS | ||
``` | ||
log.dateformat = 'HH:MM'; | ||
log.display('dateformat', 'HH:MM'); | ||
log.format('custom', '{{file}}:{{line}} custom: {{message}} {{timestamp}}'); | ||
@@ -117,5 +117,13 @@ ``` | ||
``` | ||
// Writes all logs to logs.txt (default is process.stdout) | ||
log.output(fs.createWriteStream('logs.txt')); | ||
// Writes all log.errors to ./error.log | ||
log.output('error', './error.log'); | ||
// Writes all section logs to myWriteStream | ||
log.output('section', myWriteStream); | ||
log.output('section/error', myErrorStream); // Hides all log.error | ||
// Writes all errors in section to myErrorStream | ||
log.output('section/error', myErrorStream); | ||
``` | ||
@@ -126,11 +134,5 @@ | ||
- `config(options)` - Takes an object of options. Valid properties are: | ||
- `overrideConsole` (boolean) - allows the user to override the console to use `better-logs` instead. | ||
- `showByDefault` (boolean) - show logs by default (if false, hides by default) | ||
- `mode` (string) - active mode | ||
- `modes` (object) - object where the key is the mode name, and the value is an object containing: `showByDefault`, `hide` and/or `show`. | ||
- `hide([section])` - Hides all logs. If a section/group string is provided, it would only hide those logs. | ||
- `show([section])` - Shows all logs. If a section/group string is provided, it would only show those logs. | ||
- `reset()` - Resets all visibility back to its default state. | ||
- `reset([section])` - Resets the visibility state back to the default inherited state. If a section/group string is provided, it would only reset those logs. | ||
- `modes()` - Returns all defined modes | ||
@@ -137,0 +139,0 @@ - `mode()` - Returns current active mode |
155
37082
931