1.0.2 • Published 7 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-log
Create 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"] ... } }
enabled
Boolean: whether enable this component. defaults: truehttp
Boolean: whether log the http request. defaults: true- the Model.json can control it if not settings.
level
String: the log level string: "trace", "debug", "info", "warn", error", "fatal". defaults: "info"useStdOut
Boolean: whether log to stdout. defaults: trueuseLogFile
Boolean: whether log to the file. defaults: falsemaxResponseTime
Integer: 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