Request Logs
Logging so called ‘request logs’ is the main feature of this logging library. Request logs get issued for each handled http/s request and contain information about the request itself, its response and also CF metadata.
Table of contents
Attaching to server frameworks
The library can be provided as middleware to log requests as follows:
app.use(log.logNetwork);
When using a plain Node.js http server it is necessary to call the network logging function directly:
http.createServer((req, res) => {
log.logNetwork(req, res);
...
});
You can find code samples for supported server frameworks in the Framework Samples section.
Setting the log level for requests
You can set the level to be assigned to request logs as follows:
log.setRequestLogLevel("verbose");
The default log level for request logs is info
.