Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MessageLog ¶ added in v0.1.9
type MessageLog struct {
// contains filtered or unexported fields
}
MessageLog writes a human-readable, per-event decoded-message log — the GopherTrunk analogue of SDRtrunk's per-channel decoded message log. It subscribes to the events bus and appends one timestamped line per trunking event (grants, control-channel lock/loss, affiliations, registrations, patches, talker aliases, locations, tone alerts, decode errors). The file rotates to "<path>.1" when it exceeds the configured size cap.
func NewMessageLog ¶ added in v0.1.9
func NewMessageLog(opts MessageLogOptions) (*MessageLog, error)
NewMessageLog opens the log file and subscribes to the bus.
func (*MessageLog) Close ¶ added in v0.1.9
func (m *MessageLog) Close() error
Close releases the bus subscription, waits for Run to drain, and closes the file.
type MessageLogOptions ¶ added in v0.1.9
type MessageLogOptions struct {
Bus *events.Bus
// Path is the log file path. Required.
Path string
// MaxSizeMB caps the file size before rotation. Default 16.
MaxSizeMB int
}
MessageLogOptions configure a MessageLog.
type SwappableWriter ¶ added in v0.1.5
type SwappableWriter struct {
// contains filtered or unexported fields
}
SwappableWriter is an io.Writer that can be redirected to a different target at runtime without re-wiring the slog handler. The daemon installs one as the slog sink at startup; the launcher redirects it to a tempfile while the in-process TUI owns the terminal, then restores it on exit so headless mode keeps stderr.
func NewSwappableWriter ¶ added in v0.1.5
func NewSwappableWriter(w io.Writer) *SwappableWriter
NewSwappableWriter returns a SwappableWriter pointed at w.
func NewWithSwap ¶ added in v0.1.5
func NewWithSwap(level, format string) (*slog.Logger, *SwappableWriter)
NewWithSwap is the variant used by main: it returns both the slog Logger and the SwappableWriter behind its handler, so the launcher can redirect stderr while the TUI runs.
func (*SwappableWriter) Redirect ¶ added in v0.1.5
func (s *SwappableWriter) Redirect(w io.Writer)
Redirect replaces the active target. The previous target is remembered so Restore can reinstate it.
func (*SwappableWriter) Restore ¶ added in v0.1.5
func (s *SwappableWriter) Restore()
Restore reverts to the writer that was active before the most recent Redirect. No-op when nothing was saved.