logfile

package
v0.0.350 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package logfile is the single, shared rotating-append writer for satelle's flat evidence logs under .satelle/logs (the operation log and the reviewer log). It bounds their growth — roll by UTC day and by max size, keep at most N rotated files — so a long-running repo does not accumulate an unbounded log (sty_a67e6e8c).

It is deliberately stateless and best-effort, matching how the evidence logs are written: each Append opens, rotates-if-needed, writes one line, and closes. A logging error never breaks the caller (the caller may ignore the returned error).

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{MaxSizeBytes: 5 << 20, MaxFiles: 7}

DefaultConfig is the fallback when config resolves to nothing sensible: a 5 MiB size cap and 7 kept rotations (plus daily rolling, which is always on).

Functions

func Append

func Append(now time.Time, path string, cfg Config, line string) error

Append writes line (a trailing newline is added) to path, ROLLING the file over first when it has aged into a new UTC day since its last write or when the write would push it past cfg.MaxSizeBytes. A roll renames path to <base>-<YYYYMMDD-HHMMSS>.log (a numeric suffix breaks a same-second tie), then prunes the oldest rotations beyond cfg.MaxFiles. Best-effort: a mkdir/open error is returned but a caller may ignore it.

Types

type Config

type Config struct {
	MaxSizeBytes int64 // roll before a write that would exceed this size
	MaxFiles     int   // keep at most this many ROTATED files (the active file is extra)
}

Config bounds a rotating log file. A non-positive limit disables that bound.

Jump to

Keyboard shortcuts

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