Structured logging for Go, built on zerolog. It integrates tcfg for configuration, optional log-file rotation, Sentry for error reporting, and ttrace for trace identifiers in context.
- Leveled logging (
D/I/W/E/F/P) with a single package-level logger initialized at startup - Optional
detailfield viaDetail/Detailf, anderrorviaErr - Trace ID injection when the context carries a valid ID from
ttrace - Optional rotating log files (size, time, retention, gzip)
- Error-level lines may be forwarded to Sentry when a DSN is configured
go get github.com/choveylee/tlogimport (
"context"
"github.com/choveylee/tlog"
)
func example(ctx context.Context) {
tlog.I(ctx).Msg("hello")
tlog.E(ctx).Err(err).Msg("operation failed")
tlog.I(ctx).Detailf("user=%d", id).Msgf("request %s", reqID)
}Configuration keys are defined as exported constants (for example LogLevel, SentryDsn, LogFileEnable) and are read through tcfg during package initialization.
The package overview and linked references live in doc.go. View rendered documentation with:
go doc -all github.com/choveylee/tlog