logfiles

package
v0.38.6 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package logfiles wires per-component dated log files for wick runtimes that own their own process (tray on GUI hosts, headless `all` spawned by `wick start`). It opens app/server/worker/mcp files under ~/.<appName>/logs/, pipes os.Stdout / os.Stderr into app.log so fmt.Printf and panic traces survive when the real console is detached, and prunes files older than the retention window.

Layout:

~/.<appName>/logs/
  app-YYYY-MM-DD.log     // tray / startup / global zerolog + stdout/stderr
  server-YYYY-MM-DD.log  // HTTP server (zerolog component=server)
  worker-YYYY-MM-DD.log  // job worker (zerolog component=worker)
  mcp-YYYY-MM-DD.log     // wickmanager MCP audit

Each file is tee'd to the original stderr so an interactive operator still sees output in the terminal. When the caller has no real stderr (tray detaches the console, daemon redirects to daemon-DATE.log), the file is the only sink — that's the intent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set struct {
	App    zerolog.Logger
	Server zerolog.Logger
	Worker zerolog.Logger
	MCP    zerolog.Logger
	Dir    string
}

Set bundles the per-component loggers produced by Setup. Callers wire each logger into the relevant subsystem (server / worker / mcp) and use App as the global zerolog default.

func Setup

func Setup(appName string, retentionDays int) (Set, func(), error)

Setup creates the dated log files, installs stdout/stderr pipes that funnel fmt.Printf and panic traces into app.log, points the global zerolog log.Logger and stdlib log at the App logger, and returns a cleanup func that flushes the pipe goroutines then closes all files. retentionDays <= 0 falls back to the default (7 days).

Jump to

Keyboard shortcuts

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