1.0.2 • Published 9 years ago
loopback-component-log v1.0.2
Loopback Component Log
The loopback component add the log function to the loopback.
Installation
Install in you loopback project:
npm install --save loopback-component-logCreate a component-config.json file in your server folder (if you don't already have one)
Configure options inside
component-config.json:{ "loopback-component-log": { "enabled": true, "name": "logger", "http": true, "level": "info", "useStdOut": true, "useLogFile": false, "path": "./logs" "maxResponseTime": 30000, "excludes": ["req","res"] ... } }
enabledBoolean: whether enable this component. defaults: truehttpBoolean: whether log the http request. defaults: true- the Model.json can control it if not settings.
 
levelString: the log level string: "trace", "debug", "info", "warn", error", "fatal". defaults: "info"useStdOutBoolean: whether log to stdout. defaults: trueuseLogFileBoolean: whether log to the file. defaults: falsemaxResponseTimeInteger: treat if as fatal if response exceed the time. default :30000- 0 or null means do not enable this feature .
 
- see the
 
Usage
Just enable it on component-config.json.
var loopback = require('loopback');
var rootlog = loopback.log;
rootlog.info("hi");
rootlog.warn({lang: 'fr'}, 'au revoir');set DEBUG=loopback:component:log env vaiable to show debug info.
History
TODO
- !syslog stream