@matfire/adonis-logsnag
v0.2.0
Published
expose logsnag in a controller's http context
Downloads
1
Maintainers
Readme
Adonis Logsnag
A package to expose a logsnag instance inside AdonisJS's http handler.
Install
install the package by using
npm install @matfire/adonis-logsnag
Configure
configure the package using ace
node ace configure @matfire/adonis-logsnag
This will create a logsnag.ts config file in the config folder, along with adding a couple validation rules for your .env file. Once all this is done, you'll need to add some variable to the .env:
- LOGSNAG_TOKEN: your logsnag token
- LOGSNAG_PROJECT: your logsnag project id
Use
Once the module is enabled, it will inject a logsnag instance into your HttpContext: you can use like you would any logsnag instance. One way to get that instance would be:
class AppController {
index({logsnag}: HttpContext) {
logsnag.track() // or anything else logsnag can do
}
}