Expand description
Structured logging configuration.
Ported from internal/logging (config.go, logger.go) and
internal/logging/cliflags (flags.go). This crate uses
tracing/tracing-subscriber as the idiomatic Rust equivalent of
Go’s log/slog + tint (see PORT_NOTES.md).
new_logger/new_logger_with_writer install a small hand-rolled
[tracing::Subscriber] (see the private format submodule) rather
than tracing_subscriber::fmt’s built-in formatter, because the
ported tests assert on the exact abbreviated level tags
("INF"/"WRN") and ANSI colouring tint produces in the Go
original – tracing_subscriber::fmt’s default formatter spells
levels out in full ("INFO"/"WARN") and has no built-in "source"
field, neither of which the ported assertions would tolerate.
Re-exports§
Modules§
Enums§
- Logger
Error - Ported from
ErrUnsupportedFormat.
Functions§
- is_
terminal - Ported from
isTerminal. Go checks whether the underlyingio.Writeris backed by a real TTY (viagolang.org/x/term.IsTerminalon the file descriptor); aVec<u8>buffer or other non-fd-backed writer is never a terminal. - new_
logger - Ported from
NewLogger. Returns the writer’sDrop/close handle alongside the logger, mirroring Go’sio.Closerreturn value. - new_
logger_ with_ writer - Ported from
NewLoggerWithWriter. Unlikenew_logger, the caller already ownswand is responsible for flushing/closing it; this function only wraps it in the same shared, lockable handleLoggerSubscriberneeds to be usable concurrently with any other clone of the returned dispatch.