Skip to content

disgoorg/dislog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Reference Go Report Go Version License Disgo Version Disgo Discord

dislog

dislog is a logrus logging hook sending logs over Discord Webhooks using the disgohook library

Getting Started

Installing

go get github.com/disgoorg/dislog

Usage

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

Documentation can be found here

  • Go Reference
  • logrus Hooks Documentation

Examples

You can find examples here

Troubleshooting

For help feel free to open an issue or reach out on Discord

Contributing

Contributions are welcomed but for bigger changes please first reach out via Discord or create an issue to discuss your intentions and ideas.

License

Distributed under the License. See LICENSE for more information.