zlogjs-express-logger
log express request, response, locally or on a remote server.
DESCRIPTION
zlogjs-express-logger is a plugin for zlogjs-adapter to log native http server requests and responses.
Table of Contents
Installation
npm install zlogjs-express-logger --save
Configuration
As this logger is a plugin of zlogjs-adapter, you need to install that first.
To log locally just put the value of mode local
otherwise remote
.
var config = collections: adapter: host:'host' port:'port' adapter: plugin:'zlogjs-express-logger' appId:'appid' apiKey:'apikey' mode:'remote' ;
Skip
var config = collections: adapter: host:'host' port:'port' adapter: plugin:'zlogjs-express-logger' appId:'appid' apiKey:'apikey' mode:'remote' SKIP: '/api1':true '/api2':CODE:204 '/api4':METHOD:'get' '/api6':CODE:'>':200'<':300 SKIP_CODE:400 ;
Tags
var config = collections: adapter: host:'host' port:'port' adapter: plugin:'zlogjs-express-logger' appId:'appid' apiKey:'apikey' mode:'remote' TAGS: "/api/a":"tag1" "/api/b":"tag1:tvalue" "/api/c":"tag1:tvalue""tag2:tvalue" "/api/d":"tag1""tag2" "/api/e":"tag1":"tvalue""tag2":"tvalue" "splitter":":" ;
Log
To start using this logger you need to construct it from zlogjs-adapter and enoa-client. Then you need to include it as a middleware of the express application.
Global
var logger = configadapterlogger;express_app;
Specific
you need to add an additional header x-man-zlogjs
to the request object if you manually log something
//req.headers['x-man-zlogjs'] = true;;
Issues and Suggestions
This is the first version of zlogjs-express-logger, so we are looking forward to make this logger perfect. if there is any issue or you want to add new feature to the logger please feel free to raise it.