MCPcopy
hub / github.com/redpanda-data/console / Example_productionConfiguration

Function Example_productionConfiguration

backend/pkg/logger/example_test.go:162–179  ·  view source on GitHub ↗

Example_productionConfiguration demonstrates a typical production setup.

()

Source from the content-addressed store, hash-verified

160
161// Example_productionConfiguration demonstrates a typical production setup.
162func Example_productionConfiguration() {
163 // Production logger: JSON mode, info level, with metrics
164 registry := prometheus.NewRegistry()
165
166 log := logger.NewSlogLogger(
167 logger.WithFormat(logger.FormatJSON),
168 logger.WithLevel(slog.LevelInfo),
169 logger.WithPrometheusRegistry(registry, "console"),
170 logger.WithDefaultAttrs(
171 slog.String("service", "redpanda-console"),
172 slog.String("version", "1.0.0"),
173 slog.String("environment", "production"),
174 ),
175 )
176
177 log.Info("service started successfully")
178 log.Error("connection failed", slog.String("err", "timeout"), slog.Int("retry_count", 3))
179}
180
181// Example_developmentConfiguration demonstrates a typical development setup.
182func Example_developmentConfiguration() {

Callers

nothing calls this directly

Calls 2

StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…