simple-express-logger
Description
Logs requests to the console in a format like this: Request: {GET} /api/foo
NOTE: This simply logs every request coming into the server, not just requests who's routes have been handled in express
Usage
- Install via npm:
$ npm install --save simple-express-logger
- Import and instantiate the module, then use it as middleware
var express = ;var logger = ; var app = ;app;
Checkout the API section for information about customization through an optional options
object
API
logger([options])
-
options
<Object
> Set of configurable options. Can have the following fields:customOutput
<Function>
Function used in place ofconsole.log
. Useful for externally redirecting the output.extraFields
<Array String>
Set of field names on thereq
<Object>
to also be logged. For example, anoptions
object of{ extraFields: [ 'headers' ] }
will log somthing similar to the following line:headers: "{ "foo": 1, "bar": 2 }"