api-logger
This package helps you to log HTTP requests in Express Node.js application.
Installation
npm install api-logger
Usage
You can initialize the new instance of api-logger with or without passing existing winston logger. And, then can use the module as middleware in the application.
Using default winston logger
By default, only the Console logging is set on the default api-logger.
var app = ;var apiLogger = ; app; app; app;
Instantiating your own Logger
If you would prefer to manage the loggers, you can to instantiate them yourself and can pass to api-logger:
var app = ;var winston = ;var apiLogger = ; var customLogger = new winstonLogger transports: new winstontransportsConsole new winstontransportsFile filename: 'somefile.log' ; app; app; app;
Sample Output
info: 10/11/2016 3:00:23 PM GET / 200info: 10/11/2016 3:00:23 PM GET /faviconico 404info: 10/11/2016 3:00:35 PM GET /app 404