Go

Lyrelog for Go

No dependencies, and a handler for log/slog: the logger you already use sends its records, attributes included, while logging itself never fails.

import "go.lyrelog.com/lyrelog"

client, err := lyrelog.New(lyrelog.Config{
	// a server key, or read it from your own config
	APIKey:   "lyr_srv_...",
	Platform: "api",
})
if err != nil {
	// only for a bad config: logging itself never fails
	log.Fatal(err)
}
defer client.Close() // sends what is left (waits at most 5 s)

Version 1.0.0. Go 1.24 or later. No dependencies.

What it does on Go

Start it and these come with it. Where the platform can't tell by itself, it's a call or a few lines, all in the guide.

  • A call or a few linesCrashes and uncaught errorsA recover middleware: the SDK doesn't recover panics
  • On its ownSessionsOne per process
  • A call or a few linesEnvironment, told apartLYRELOG_ENVIRONMENT, else production
  • A call or a few linesEvents wait when offlineIn memory, up to 10,000 events: Close before exiting
  • On its ownVerified eventsWith a server key
  • On its ownYour existing loggingA log/slog handler

Go, in practice

What the guide says to keep in mind on this platform.

  • log.Fatal and os.Exit skip deferred calls: return from a run() instead.
  • Structs are redacted by their JSON names, and http.Header too.
  • A net/http middleware that records each request is in the guide.
  • The Go guide

See it with your own app's events

Sign up with GitHub, Google or Apple. Your organization starts on Free; move it to Pro whenever you want.