Expand description
truefix-log — pluggable FIX logging with message/event stream separation (FR-H2).
The Log trait separates message logging (inbound/outbound wire messages) from
event logging (session lifecycle, errors). Implementations: ScreenLog, FileLog,
TracingLog, and CompositeLog (fan-out).
Audit 006 additions: FileLogOptions::max_size_bytes rotates messages.log/event.log
once either exceeds the configured size (NEW-108); FileLog always timestamps event lines
and surfaces write failures instead of discarding them silently (NEW-124, NEW-125); and
LogConfig (in truefix-config) threads file-backend options through generic log
configuration (NEW-126).
Feature 012 (audit 007) additions: FileLog’s constructors (open/open_with_options, and
build_log for LogConfig::File) are now async and queue writes onto a bounded channel
consumed by a background writer task — the same channel + background-writer shape
SqlLog/MssqlLog/MongoLog/RedbLog (each behind its own Cargo feature) already use — so
on_incoming/on_outgoing/on_event never block the calling async task on disk I/O
(NEW-156). Log::shutdown on FileLog drains that queue before returning; a background
write/flush failure is surfaced via a structured tracing::error! event and a
truefix_log_write_failures_total metrics counter (NEW-156, FR-009) instead of the previous
best-effort eprintln!.
Design: specs/001-fix-engine-parity/, specs/012-audit-007-remediation/.
Structs§
- Composite
Log - Fans every entry out to each wrapped log.
- FileLog
- Logs inbound/outbound messages to
messages.logand events toevent.logvia a bounded channel and background writer task (NEW-156). - File
LogOptions - Output switches for
FileLog(FR-026):FileLogHeartbeats/FileIncludeMilliseconds/FileIncludeTimeStampForMessages. - Retention
Policy - Composable retention policy for
FileLog’s rotated backups (NEW-157). Both fields are independently optional and may be set together (e.g. “roll daily, keep the last 30 dated files”). - Screen
Log - Logs messages to stdout and events to stderr, with direction prefixes.
- Screen
LogOptions - Output switches for
ScreenLog(FR-026):ScreenLogShowEvents/ScreenLogShowHeartBeats/ScreenLogShowIncoming/ScreenLogShowOutgoing/ScreenIncludeMilliseconds. - Session
Prefix Log - Wraps any
Logimplementation, prepending[{session_id}]to every message/event before delegating. Generic over the wrapped log so it composes with any sink (screen/file/SQL/ tracing/composite) without each implementation needing its own session-ID-prefix option. - Tracing
Log - Logs via the
tracingfacade, separating message and event targets. - Tracing
LogOptions - Output switches for
TracingLog(FR-026):SLF4JLogHeartbeats. Session-ID prefixing (SLF4JLogPrependSessionID) is provided generically by wrapping incrate::SessionPrefixLograther than as a field here.
Enums§
Traits§
- Log
- A FIX log sink. Message logging (incoming/outgoing) is kept separate from event logging.