Adonis Http Logger
Add-on to log your Http requests using Adonis inbuilt logger.
Add-on to log your Http requests using Adonis inbuilt logger.
Setup
Start by installing it from npm.
adonis install @adonisjs/http-logger
adonis install @adonisjs/http-logger --yarn
Register provider
Register the provider inside start/app.js
file.
const providers = [
'@adonisjs/http-logger/providers/LoggerProvider'
]
That's all :)
Config
There is only one config setting, that is to define the environments in which the logger should run.
You have to modify the existing config/app.js
file and the following setting.
module.exports = {
http: {
loggerEnv: ['development', 'production']
}
}
By default, it will log in every environment.
Sane defaults
This module will internally make use of AdonisJs Logger
provider, which means it will log messages using the default driver.
When json:true
config is set. It will log request properties as a JSON object, so that you can easily query over them.
Check the following screenshot when json=true
and logs are sent to Loggly.