Documentation
¶
Index ¶
Constants ¶
const ( LevelDebug = "DEBUG" LevelInfo = "INFO" LevelWarn = "WARN" LevelError = "ERROR" LevelSystem = "SYSTEM" )
Variables ¶
This section is empty.
Functions ¶
func CleanLogDir ¶
CleanLogDir removes the log directory and its contents.
Types ¶
type Formatter ¶
type Formatter struct {
UseColor bool
}
Formatter formats parsed log lines with optional ANSI colors.
type LogFileWriter ¶
type LogFileWriter struct {
// contains filtered or unexported fields
}
LogFileWriter demultiplexes parsed log lines into per-handler files and a combined log file. All output is plain text (no ANSI).
func NewLogFileWriter ¶
func NewLogFileWriter(celerityDir string) (*LogFileWriter, error)
NewLogFileWriter creates a LogFileWriter that writes to {celerityDir}/logs/. Opens all.log and infra.log in append mode. Handler files are opened lazily.
func (*LogFileWriter) Close ¶
func (w *LogFileWriter) Close() error
Close closes all open file handles.
func (*LogFileWriter) HandlerFiles ¶
func (w *LogFileWriter) HandlerFiles() []string
HandlerFiles returns the names of handler-specific log files that have been written.
func (*LogFileWriter) LogDir ¶
func (w *LogFileWriter) LogDir() string
LogDir returns the path to the log directory.
func (*LogFileWriter) Write ¶
func (w *LogFileWriter) Write(line LogLine) error
Write writes a parsed log line to all.log and the appropriate handler/infra file.
type LogLine ¶
type LogLine struct {
Timestamp string
Level string
Message string
HandlerName string
RequestID string
// Source identifies the origin of the log line. "runtime" indicates a
// Rust core runtime log (tracing JSON); empty for SDK/application logs.
Source string
RawLine string
Extra map[string]any
}
LogLine is a parsed container log line with extracted metadata.
func (*LogLine) MatchesHandler ¶
MatchesHandler checks if the handler name contains the filter substring.
func (*LogLine) MatchesLevel ¶
MatchesLevel checks if the log line meets the minimum level threshold.
type LogParser ¶
type LogParser struct {
// contains filtered or unexported fields
}
LogParser dispatches to runtime-specific SDK parsers and falls back to plain-text passthrough for unrecognised lines.
func NewLogParser ¶
NewLogParser creates a parser configured for the given application runtime.
type SDKLogParseFunc ¶
SDKLogParseFunc attempts to parse a raw log line in an SDK-specific format.
type StreamOptions ¶
type StreamOptions struct {
Follow bool
Tail string
Since string
HandlerFilter string
LevelFilter string
}
StreamOptions configures log streaming with filtering.
type Streamer ¶
type Streamer struct {
// FileWriter optionally tees parsed lines to per-handler log files.
FileWriter *LogFileWriter
// contains filtered or unexported fields
}
Streamer reads container logs from the Docker API, parses them, applies filters, and writes formatted output.
func NewStreamer ¶
func NewStreamer( dockerMgr docker.RuntimeContainerManager, runtime string, useColor bool, ) *Streamer
NewStreamer creates a log streamer configured for the given application runtime.
func (*Streamer) Stream ¶
func (s *Streamer) Stream( ctx context.Context, containerID string, opts StreamOptions, writer io.Writer, ) error
Stream reads and formats container logs to the given writer. Parses each line independently (JSON or plain-text passthrough). Blocks until context cancellation or stream end.
func (*Streamer) SyncToFiles ¶
func (s *Streamer) SyncToFiles( ctx context.Context, containerID string, opts StreamOptions, ) (*SyncResult, error)
SyncToFiles reads all available container logs and writes them to log files without any stdout output. FileWriter must be set before calling.
type SyncResult ¶
SyncResult summarises a SyncToFiles operation.