logger

package
v0.511.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package logger provides a unified structured logging foundation for DeltaScope surfaces. input: logging configuration (level, format, output path) and surface identifier output: configured *slog.Logger instances and bridges to *log.Logger for legacy consumers pos: infrastructure adapter for structured logging across server and MCP surfaces note: if this file changes, update this header and module README.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(cfg Config, surface string) (*slog.Logger, error)

NewLogger creates a configured *slog.Logger for the given surface. Surface must be "server" or "mcp". When surface is "mcp" and Output is "stdout", NewLogger returns an error to prevent stdout log pollution that would break MCP stdio.

func NewStdLogger

func NewStdLogger(sl *slog.Logger) *log.Logger

NewStdLogger bridges a *slog.Logger to a *log.Logger for legacy consumers. If sl is nil, it returns a logger that writes to os.Stderr at info level using a JSON handler.

Types

type Config

type Config struct {
	Level    string        // debug, info, warn, error — default "info"
	Format   string        // json, text — default "json"
	Output   string        // stderr, stdout, file — default "stderr"
	FilePath string        // required when Output is "file"
	Rotate   *RotateConfig // optional rotation; nil means plain append
}

Config configures structured logger creation.

type RotateConfig

type RotateConfig struct {
	Enabled    bool
	MaxSizeMB  int   // default 100
	MaxBackups int   // default 3
	MaxAgeDays int   // default 30
	Compress   *bool // nil defaults to true; set explicitly to false to disable
}

RotateConfig configures log file rotation via lumberjack. All fields use sensible defaults when zero.

Jump to

Keyboard shortcuts

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