gcpslog

package module
v0.0.0-...-0c01a0f Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 7 Imported by: 7

README

This work has moved to https://github.com/chainguard-dev/clog/tree/main/gcp and this repo will not receive updates.

Documentation

Index

Constants

View Source
const LevelCritical = slog.Level(12)

LevelCritical is an extra log level supported by Cloud Logging.

Variables

This section is empty.

Functions

func WithCloudTraceContext

func WithCloudTraceContext(h http.Handler) http.Handler

WithCloudTraceContext returns an http.handler that adds the GCP Cloud Trace ID to the context. This is used to correlate the structured logs with the request log.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler that outputs JSON understood by the structured log agent. See https://cloud.google.com/logging/docs/agent/logging/configuration#special-fields

func NewHandler

func NewHandler(level slog.Level) *Handler

func (*Handler) Enabled

func (h *Handler) Enabled(ctx context.Context, level slog.Level) bool

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, rec slog.Record) error

func (*Handler) WithAttrs

func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*Handler) WithGroup

func (h *Handler) WithGroup(name string) slog.Handler

Directories

Path Synopsis
cmd
app
cli

Jump to

Keyboard shortcuts

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