watcher

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 1 Imported by: 0

README

Watcher

A simple and efficient package to handle staging and production errors.

Prerequisite

You need a Slack application that supports incoming webhooks.

Configuration

Create a SlackConfig in your go code.

package myPackage

import "github.com/Alvarios/watcher"

var Watcher watcher.SlackConfig

func main() {
    Watcher := watcher.SlackConfig{
        WebHook: "https://hooks.slack.com/services/XXXXX/XXXXX/XXXXX",
        Application: "Your application name",
        Environment: "Your environment",
    }
}

Methods

Error

Send a basic error message to Slack.

package myPackage

func MyFunction() {
	_, err := Watcher.Error("some error message")
}
Fatal

Same as Error method, but kills the running server and doesn't return any status.

package myPackage

func MyFunction() {
	Watcher.Fatal("some fatal message")
}
GinAbort

A special message formatter for Gin, that also interrupts the request.

package myPackage

import "github.com/gin-gonic/gin"

func MyMiddleware(c *gin.Context) {
	Watcher.GinAbort(c, "some error message")
}

2020 Kushuh - MIT license

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SlackConfig setup.SlackConfig

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL