cloudslog

package
v0.73.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package cloudslog provides primitives for structured logging with the standard library log/slog package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(config LoggerConfig) slog.Handler

NewHandler creates a new slog.Handler with special-handling for Cloud Run.

Types

type LoggerConfig

type LoggerConfig struct {
	// Development indicates if the logger should output human-readable output for development.
	Development bool `default:"true" onGCE:"false"`
	// Level indicates which log level the logger should output at.
	Level slog.Level `default:"debug" onGCE:"info"`
	// ProtoMessageSizeLimit is the maximum size, in bytes, of requests and responses to log.
	// Messages large than the limit will be truncated.
	// Default value, 0, means that no messages will be truncated.
	ProtoMessageSizeLimit int `onGCE:"1024"`
}

LoggerConfig configures the application logger.

Jump to

Keyboard shortcuts

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