logging

package
v0.0.0-...-8b0bed9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 2 Imported by: 7

Documentation

Index

Constants

View Source
const LevelCritical = slog.Level(12)

Variables

View Source
var Logger = slog.New(slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{
	AddSource: true,
	Level:     slog.LevelDebug,
	ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
		if a.Key == slog.MessageKey {
			a.Key = "message"
		} else if a.Key == slog.SourceKey {
			a.Key = "logging.googleapis.com/sourceLocation"
		} else if a.Key == slog.LevelKey {
			a.Key = "severity"
			level := a.Value.Any().(slog.Level)
			if level == LevelCritical {
				a.Value = slog.StringValue("CRITICAL")
			}
		}
		return a
	}}))

Functions

func FunctionLogger

func FunctionLogger(functionName string) *slog.Logger

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL