log-http
Log HTTP requests. Works well with pino and pino-colada.
Usage
var logHttp = var http = var pino = var log = var server = http var stats = stats server
Output
{"pid":42140,"hostname":"anons-MacBook.local","level":30,"time":1492003344167,"url":"/","method":"GET","message":"request","contentLength":89,"v":1}{"pid":42140,"hostname":"anons-MacBook.local","level":30,"time":1492003344170,"url":"/","method":"GET","statusCode":200,"message":"response","elapsed":4,"contentLength":119,"v":1}{"pid":42140,"hostname":"anons-MacBook.local","level":30,"time":1492003352734,"url":"/","method":"GET","message":"request","contentLength":89,"v":1}{"pid":42140,"hostname":"anons-MacBook.local","level":30,"time":1492003352734,"url":"/","method":"GET","statusCode":200,"message":"response","elapsed":1,"contentLength":119,"v":1}
API
stats = logHttp(server)
Create a new stats emitter from a server instance.
stats.on('data', function(level, data))
Listen to a new incoming or outgoing request. Logs out the expected log level and corresponding data. Should be passed to a logger.