Skip to content

Hu13er/telegrus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Hooks for Logrus :walrus:

Install

$ go get github.com/Hu13er/telegrus

Usage

package main

import (
    "github.com/sirupsen/logrus"
    "github.com/Hu13er/telegrus"
)

func main() {
    log := logrus.New()
    
    var (
        botToken = ""      // Your Bot token
        chatID = int64(0) // Your chatID
    )

    logrus.AddHook(
        telegrus.NewHooker(botToken, chatID).
            MentionOn(logrus.WarnLevel,
                "Hu13er", "foobar").
            MentionOn(logrus.ErrorLevel,
                "Huberrr").
            SetLevel(logrus.InfoLevel),
    )

    logrus.Debugln("This is a DEBUG")
    logrus.Infoln("This is an INFO")
    logrus.Warnln("This is a WARN")
    logrus.Errorln("This is an ERROR")
    fmt.Scanln()
}

License

MIT

About

Telegram hooks for Logrus

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages