https://github.com/disgoorg/dislog
Logrus Hook for sending Logs into Discord
https://github.com/disgoorg/dislog
discord-logging go golang logrus logrus-hook
Last synced: 11 months ago
JSON representation
Logrus Hook for sending Logs into Discord
- Host: GitHub
- URL: https://github.com/disgoorg/dislog
- Owner: disgoorg
- License: apache-2.0
- Created: 2021-04-21T18:17:35.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-17T01:52:03.000Z (over 3 years ago)
- Last Synced: 2025-05-06T15:30:11.504Z (about 1 year ago)
- Topics: discord-logging, go, golang, logrus, logrus-hook
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/disgoorg/dislog)
[](https://goreportcard.com/report/github.com/disgoorg/dislog)
[](https://golang.org/doc/devel/release.html)
[](https://github.com/disgoorg/dislog/blob/master/LICENSE)
[](https://github.com/disgoorg/dislog/releases/latest)
[](https://discord.gg/BDfhKG7Ce8)
# dislog
dislog is a [logrus](https://github.com/sirupsen/logrus) [logging hook](https://github.com/sirupsen/logrus#hooks) sending logs over [Discord Webhooks](https://discord.com/developers/docs/resources/webhook) using the [disgohook](https://github.com/disgoorg/dislog) library
## Getting Started
### Installing
```sh
go get github.com/disgoorg/dislog
```
### Usage
Import the package into your project.
```go
import "github.com/disgoorg/dislog"
```
Create a new [logrus](https://github.com/sirupsen/logrus) logger then create a new dislog instance by providing the webhook id and webhook token.
```go
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
Documentation can be found here
* [](https://pkg.go.dev/github.com/disgoorg/dislog)
* [](https://github.com/sirupsen/logrus#hooks)
## Examples
You can find examples [here](https://github.com/disgoorg/dislog/tree/master/_examples)
## Troubleshooting
For help feel free to open an issue or reach out on [Discord](https://discord.gg/BDfhKG7Ce8)
## Contributing
Contributions are welcomed but for bigger changes please first reach out via [Discord](https://discord.gg/BDfhKG7Ce8) or create an issue to discuss your intentions and ideas.
## License
Distributed under the [](https://github.com/disgoorg/dislog/blob/master/LICENSE). See LICENSE for more information.