ubgo is in early alpha: libraries and APIs may still change.

Skip to content
ubgo Alpha

logger

Adapter-based, slog-native structured logging with sampling, redaction, OpenTelemetry and rotation.

go get github.com/ubgo/logger
Language
Go
Go version
1.24
Core deps
0 direct
Latest tag
none
License
Apache-2.0
Go modules
8

How it fits together

Highlights from the README

  • ✅ slog-native — it is a correct slog.Handler (passes the standard library’s testing/slogtest). The entire slog ecosystem composes on top.
  • ✅ Zero-allocation typed hot path (CI-enforced), competitive with zap and zerolog.
  • ✅ One extension seam — a processor pipeline. Redaction, sampling, enrichment, dedup are all the same concept.
  • ✅ Batteries included — rotation, redaction, sampling, OTEL correlation, FingersCrossed, audit, network/cloud sinks — built in, not 50 dependencies.
  • ✅ Drop-in migration from zap, zerolog, logrus, std log, and logr.

Code from the README

package main

import logger "github.com/ubgo/logger"

func main() {
	log := logger.New() // JSON to stderr at Info
	defer log.Close()

	log.Info("server started", logger.String("addr", ":8080"), logger.Int("pid", 4242))
}

From the logger README.

At a glance (from the README)

FromHowModule
log/slogslog.SetDefault(log.NewSlog())core (no extra dep)
std loglogger.RedirectStdLog(log, logger.LevelInfo)core
uber-go/zapzaplogger.New(core, zapcore.InfoLevel)contrib/zap
sirupsen/logruslogruslogger.Attach(logrusLogger, core)contrib/logrus
rs/zerologzerologlogger.New(zl, logger.LevelInfo)contrib/zerolog
phuslu/logphulogger.New(pl, logger.LevelInfo)contrib/phuslu
go-logr/logrlogrlogger.New(core)contrib/logr