working on more informative log files

parent 5a37ba0a
......@@ -55,6 +55,19 @@ customLogger.add(winston.transports.File, {
filename: path.resolve(__dirname, '../..', 'logs', 'error.json')
});
customLogger.add(winston.transports.File, {
name: 'error-json',
silent: false,
colorize: false,
level: 'info',
showLevel: true,
timestamp: true,
json: true,
tailable: true,
maxsize: 5 * 1024 * 1024, // 5 MegaByte
filename: path.resolve(__dirname, '../..', 'logs', 'info.json')
});
module.exports.log = {
level: 'silly',
inspect: false,
......
......@@ -20,6 +20,13 @@
* http://sailsjs.org/#/documentation/concepts/Routes/RouteTargetSyntax.html
*/
module.exports.routes = {
// This is to log to info every access
'/*': function(req, res, next) {
sails.log.info(req.method, req.url, req.allParams());
next();
},
// Grouped by API url (/a, /b, ...)
// Sorted by HTTP method (GET, PUT, POST and DELETE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment