logging

package
v1.1.36 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger added in v1.1.6

func NewLogger(level slog.Level) *slog.Logger

NewLogger creates a new slog.Logger with a text handler at the given level.

func NewWriter added in v1.1.6

func NewWriter(logger *slog.Logger) io.WriteCloser

NewWriter returns an io.WriteCloser that logs each line written to it using the provided slog.Logger at Info level.

func ParseLevel added in v1.1.6

func ParseLevel(s string) slog.Level

ParseLevel parses a log level string into slog.Level. Supported values: debug, info, warn, error (case-insensitive). Defaults to info if the value is unrecognized.

Types

type BracketWriter added in v1.1.36

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

BracketWriter wraps an io.Writer and prefixes each complete line with a [timestamp] in the format expected by the logs.MergeLogs function. Partial writes are buffered until a newline is received.

This is used to write log files in the same format that Docker Desktop produces, so the /logs API endpoint can serve and merge-sort them correctly.

func NewBracketWriter added in v1.1.36

func NewBracketWriter(w io.Writer) *BracketWriter

NewBracketWriter creates a new BracketWriter that wraps w.

func (*BracketWriter) Write added in v1.1.36

func (bw *BracketWriter) Write(p []byte) (int, error)

Write implements io.Writer. It buffers partial input and writes each complete line to the underlying writer with a [timestamp] prefix.

type Logger

type Logger = *slog.Logger

Logger is the application logger type, backed by slog.

Jump to

Keyboard shortcuts

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