sails-hook-accesslogs
v1.1.0
Published
Sails JS hook to activate winston request logging for every request and logs access logs to file system
Downloads
3
Maintainers
Readme
sails-hook-accesslogs
Note: Requires Sails.js version >=0.11.0-rc
Sails JS hook to activate winston powered request logging (or creating access logs) for your sails app.
Installation
npm install sails-hook-accesslogs
Usage
Just lift your app as normal and all your server requests will be logged, with useful information such as response-time, straight to your console. As a default it is activated in your dev environment but deactivated in production.
Configuration
By default, configuration lives in sails.config.accesslogs
.
Parameter | Type | Details
-------------- | ------------------- |:---------------------------------
format | ((string)) | Defines which logging to use. Defaults to :remote-addr - [:date[clf]] ":method :url" :status :response-time ms ":user-agent"
.
logLocation | ((string)) | Defines where to log: console
or file
. Defaults to console
.
fileLocation | ((string)) | Location of file relative to project root (if file
is specified in logLocation
. This has no effect if console
is specified in logLocation
.
inDevelopment | ((boolean)) | Whether or not to log requests in development environment. Defaults to true
.
inProduction | ((boolean)) | Whether or not to log requests in production environment Defaults to false
.
That’s it!