slog initializer for minimalist (Golang, Opentelemetry, Google Cloud)
MIT License
sog stands for Structured Otel GoogleCloud, inspired by clog. Special thanks to nownabe.
The display of stack traces can be easily controlled at initialization. For example, you can configure it to hide stack traces locally, while enabling them on Google Cloud. |
Insert code that corresponds to the following type during initialization type LabelFieldInjector func(ctx context.Context) (key, value string, found bool)
|
slog.SetDefault(slog.New(soglog.NewCloudLoggingHandler("your-project-id", &soglog.Options{IsStackTraced: true, LabelFieldInjector: yourLabelFieldInjector})
soglog is strictly designed within the functionalities of the slog to support cloud logging. Therefore, soglog supports only 4 log levels: Debug
, Info
, Warn
, and Error
.