Example_productionConfiguration demonstrates a typical production setup.
()
| 160 | |
| 161 | // Example_productionConfiguration demonstrates a typical production setup. |
| 162 | func 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. |
| 182 | func Example_developmentConfiguration() { |