util

package
v0.0.0-...-1fec9c6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloudContextMiddleware

func CloudContextMiddleware(h http.Handler) http.Handler

func HTTPLogParamsMiddleware

func HTTPLogParamsMiddleware(h http.Handler) http.Handler

func Params

func Params(ctx context.Context) map[string]interface{}

func SetParam

func SetParam(ctx context.Context, key, value string) context.Context

func Trace

func Trace(ctx context.Context) string

func WithParams

func WithParams(ctx context.Context, params map[string]string) context.Context

func WithTrace

func WithTrace(ctx context.Context, r *http.Request) context.Context

Types

type ColourLogger

type ColourLogger struct {
	Writer io.Writer
}

func (ColourLogger) Flush

func (l ColourLogger) Flush() error

func (ColourLogger) Log

func (l ColourLogger) Log(evs ...slog.Event)

type ContextParamLogger

type ContextParamLogger struct {
	slog.Logger
}

func (ContextParamLogger) Log

func (l ContextParamLogger) Log(evs ...slog.Event)

type Entry

type Entry struct {
	Message  string `json:"message"`
	Severity string `json:"severity,omitempty"`
	Trace    string `json:"logging.googleapis.com/trace,omitempty"`

	Params map[string]interface{} `json:"params,omitempty"`
}

Entry ...

func NewEntry

func NewEntry(e slog.Event) Entry

func (Entry) String

func (e Entry) String() string

String renders an entry structure to the JSON format expected by Stackdriver.

type StackDriverLogger

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

StackDriverLogger is an implementation of monzo/slog.Logger that emits stackdriver compatible events

func (*StackDriverLogger) Flush

func (l *StackDriverLogger) Flush() error

func (*StackDriverLogger) Log

func (l *StackDriverLogger) Log(evs ...slog.Event)

Jump to

Keyboard shortcuts

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