Giter VIP home page Giter VIP logo

adonis-log-notifier's Introduction

Log Notifier

Streamline log management. Send application logs to email or Slack effortlessly.

npm-image license-image typescript-image

Pre-requisites

The @omakei/log-notifier package requires @adonisjs/core >= 5.8.5 with @adonisjs/mail>= 8.2.1

Installation

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

Variables for the log notifier package

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.

Testing

npm run test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

adonis-log-notifier's People

Contributors

omakei avatar

Stargazers

 avatar Alex Galhardo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.