Note: Requires Sails.js version >=0.11.0-rc
Sails JS hook to activate morgan request logging for yoursails app.
It can also automatically rotate your log file using the file-stream-rotator module
Forked from sails-hook-requestlogger
npm install sails-hook-requestlogger-file
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.
By default, configuration lives in sails.config.requestloggerfile.
| Parameter | Type | Details |
|---|---|---|
| format | ((string)) | Defines which logging format to use. Deaults to dev. |
| logLocation | ((string)) | Defines where to log: console, file or rotateFile. Defaults to console. If rotateFile is specified, the log file will be rotated as per fileRotationOptions config |
| fileLocation | ((string)) | Location of file relative to project root (if file or rotateFile 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. |
| fileRotationOptions | ((Object)) | A JSON Object (details here) defining the log file rotation properties (if rotateFile is specified in logLocation. This has no effect if console/file is specified in logLocation. |
fileRotationOptions defaults
| Parameter | Type | Default Value |
|---|---|---|
| frequency | ((string)) | daily |
| verbose | ((string)) | false |
| date_format | ((string)) | YYYYMMDD |
That’s it!