package main
import (
"errors"
"io"
stdlog "log"
"os"
"github.com/sveatlo/zerolog-sentry"
"github.com/rs/zerolog"
"github.com/getsentry/sentry-go"
)
func main() {
scope := sentry.NewScope()
client, _ := sentry.NewClient(sentry.ClientOptions{
// Either set your DSN here or set the SENTRY_DSN environment variable.
Dsn: "...",
// Enable printing of SDK debug messages.
// Useful when getting started or trying to figure something out.
Environment: "local",
Debug: true,
})
_ = sentry.NewHub(client, scope)
w, err := zlogsentry.New(client1)
if err != nil {
stdlog.Fatal(err)
}
defer w.Close()
logger := zerolog.New(io.MultiWriter(w, os.Stdout)).With().Timestamp().Logger()
logger.Error().Err(errors.New("dial timeout")).Msg("test message")
}
forked from archdx/zerolog-sentry
-
Notifications
You must be signed in to change notification settings - Fork 3
Sentry writer for zerolog logger
License
sveatlo/zerolog-sentry
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Sentry writer for zerolog logger
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Go 97.7%
- Makefile 2.3%