Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Log = logger{/* contains filtered or unexported fields */}
Functions ¶
func Flush ¶
func Flush()
Flush flushes the log buffer to ensure all pending messages are written. Call this before starting progress bars or other terminal output that depends on cursor position.
func GetBaseLogDir ¶
func GetBaseLogDir() string
GetBaseLogDir returns the base log directory (parent of all run directories)
func GetLogDir ¶
func GetLogDir() string
GetLogDir returns the per-run log directory path (where mithril.log and artifacts go)
func Initialize ¶
Initialize sets up file logging with the given config and run ID. If dir is empty, only stdout logging is used.
Directory structure:
<dir>/
├── runs.log # Append-only log tracking all runs
├── latest -> <run_dir>/ # Symlink to latest run directory
├── 20250104-120000Z_abc123_12345678/ # Per-run directory
│ ├── mithril.log # Main log file
│ ├── config.toml # Copy of config used for this run
│ └── leader_schedule/ # Leader schedule artifacts
│ ├── epoch905_local_12345678_validators.csv
│ ├── epoch905_local_12345678_skipped.csv
│ ├── epoch905_local_12345678_summary.txt
│ └── mismatch_12345678.log
└── 20250104-130000Z_def456_87654321/
└── ...
func SaveRunConfig ¶
SaveRunConfig saves a copy of the config to the run directory. Should be called after Initialize with the full config content.
Types ¶
type LogConfig ¶
type LogConfig struct {
Dir string // Log directory (default: /mnt/mithril-logs)
Level string // Log level: debug, info, warn, error
ToStdout bool // Also write to stdout (default: true)
MaxSizeMB int // Max log file size in MB before rotation
MaxAgeDays int // Delete logs older than this many days
MaxBackups int // Keep up to N old log files
}
LogConfig holds logging configuration (mirrors config.LogConfig)
func DefaultConfig ¶
func DefaultConfig() LogConfig
DefaultConfig returns sensible defaults for logging