1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-28 11:33:40 +02:00
Koen Punt 575960e50c Add Sentry error reporting (#128)
* support reporting errors to Sentry

* add documentation for sentry configuration
2019-01-14 16:42:10 +06:00

21 lines
481 B
Go

package raven
type Writer struct {
Client *Client
Level Severity
Logger string // Logger name reported to Sentry
}
// Write formats the byte slice p into a string, and sends a message to
// Sentry at the severity level indicated by the Writer w.
func (w *Writer) Write(p []byte) (int, error) {
message := string(p)
packet := NewPacket(message, &Message{message, nil})
packet.Level = w.Level
packet.Logger = w.Logger
w.Client.Capture(packet, nil)
return len(p), nil
}