Files
log/type.go
T
Claude f9b8770303
Test / test (push) Canceled after 0s
Test / fuzz (./compat, FuzzParseFormat) (push) Canceled after 0s
Test / fuzz (./formatter, FuzzFormatJSON) (push) Canceled after 0s
Test / fuzz (./formatter, FuzzFormatTextPolicy) (push) Canceled after 0s
Test / fuzz (./sanitizer, FuzzSanitize) (push) Canceled after 0s
Test / fuzz (./sanitizer, FuzzSerializerJSON) (push) Canceled after 0s
v0.1.13 follow a replaced, removed, moved log file properly
2026-10-15 16:54:39 -04:00

61 lines
1.6 KiB
Go

package log
import (
"io"
"os"
"time"
"github.com/lixenwraith/log/formatter"
)
// Context carries caller-stamped values emitted with a record
type Context = formatter.Context
// ContextSlots is the number of correlation values a Context carries
const ContextSlots = formatter.ContextSlots
// logRecord represents a single log entry
type logRecord struct {
heartbeat bool
TimeStamp time.Time
Trace string
Args []any
Ctx Context
Flags int64
Level int64
}
// TimerSet holds all timers used in processLogs
type TimerSet struct {
flushTicker *time.Ticker
diskCheckTicker *time.Ticker
retentionTicker *time.Ticker
heartbeatTicker *time.Ticker
retentionChan <-chan time.Time
heartbeatChan <-chan time.Time
diskInterval time.Duration
}
// fileWatch records which file the processor's handle refers to. Holding file
// keeps its address from being reused by a later handle. Processor only.
type fileWatch struct {
file *os.File // handle info was taken from
info os.FileInfo // identity of file
path string // log path for file; it changes only with a new file
lastCheck time.Time // record time of the last path check
warned bool // a refused or failed reopen was reported
}
// sink holds the console writers in one atomic.Value; warn takes split's
// warn-and-above records
type sink struct {
w io.Writer
warn io.Writer
}
// flushRequest belongs to one processor generation; the buffered reply permits
// completion even when the caller has already timed out.
type flushRequest struct {
done chan error
}