Skip to content

Keisatsu (警察) is a simple monitoring Go package

License

Notifications You must be signed in to change notification settings

hansenedrickh/keisatsu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Keisatsu

"Keisatsu desu"

Keisatsu (警察) is a simple monitoring Go package which can help to notify you by sending a webhook to the registered URL whenever there is a panic in your Go application or when you told it to send you a notification.

Getting Started

Installing

This assumes you already have a working Go environment, if not please see this page first.

go get will always pull the latest tagged release from the master branch.

go get github.com/hansenedrickh/keisatsu

Usage

First, you need to initialize the Keisatsu by providing it the necessary information

k := keisatsu.New(appName, webhookURL, secretToken)

Then, you can put this script to handle a panic situation wherever you want

defer k.WatchPanic()

Or if you want to handle expected error, then you can use this script

k.Error(message)

It will send a POST http request to the given webhook url, with this json as a body

{
  "app_name": <your_app_name>,
  "level": <error_level>,  
  "message": <error_message>,
  "stack_trace": <stack_trace>
}

The secret token will be put in the X-Secret-Token header which you can use for validating the request coming from Keisatsu.

Credit

Made with ❤️ by Hansen Edrick Harianto

About

Keisatsu (警察) is a simple monitoring Go package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages