The @omakei/log-notifier
package requires @adonisjs/core >= 5.8.5
with @adonisjs/mail>= 8.2.1
Make sure to install and configure @adonisjs/mail
beforehand if you are using mail to receive log notification, by running the following commands:
npm i @adonisjs/mail
# or
yarn add @adonisjs/mail
node ace configure @adonisjs/mail
Install the package from the npm registry as follows.
npm i @omakei/log-notifier
# or
yarn add @omakei/log-notifier
Next, configure the package by running the following ace command.
node ace configure @omakei/log-notifier
After that, add this to your config/app.ts
in the logger configuration section.
export const logger: LoggerConfig = {
//Add this property
stream: {
write: (msg: string) => {
Application.container.resolveBinding('Omakei/LogNotifier').write(msg)
console.log(msg)
},
},
}
Open the env.ts
file and define validate the environment
variables based upon the drivers you are using
SLACK_WEBHOOK: Env.schema.string()
SLACK_CHANNEL: Env.schema.string()
SLACK_ICON_URL: Env.schema.string()
SLACK_USERNAME: Env.schema.string()
SMTP_FROM: Env.schema.string()
Then add thier value to .env
file.
SLACK_WEBHOOK=
SLACK_CHANNEL=
SLACK_ICON_EMOJI=
SLACK_ICON_URL=
SLACK_USERNAME=
SMTP_FROM=
Now you can run your application and start recieve log to the your prefired channel in the config/log_notifier.ts
file.
npm run test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.