dislog is a logrus logging hook sending logs over Discord Webhooks using the disgohook library
go get github.com/disgoorg/dislog
Import the package into your project.
import "github.com/disgoorg/dislog"
Create a new logrus logger then create a new dislog instance by providing the webhook id and webhook token.
logger := logrus.New()
dlog, err := dislog.New(
// Sets which logging levels to send to the webhook
dislog.WithLogLevels(dislog.TraceLevelAndAbove...),
// Sets webhook id & token
dislog.WithWebhookIDToken(webhookID, webhookToken),
)
if err != nil {
logger.Fatal("error initializing dislog: ", err)
}
defer dlog.Close()
logger.AddHook(dlog)
Documentation can be found here
You can find examples here
For help feel free to open an issue or reach out on Discord
Contributions are welcomed but for bigger changes please first reach out via Discord or create an issue to discuss your intentions and ideas.