mirror of
https://github.com/tokio-rs/tracing.git
synced 2026-03-15 02:27:47 +00:00
## Motivation Support for writing tracing-based logs directly to their standard destination while preserving both standard and custom metadata on Linux systems. Improves usability of Linux services and for Linux applications executing outside of a terminal. ## Solution It turns out [journald's native protocol][1] is very simple and spoken over a Unix datagram socket at a fixed location (see [discussion of stability of these interfaces][2], allowing high quality native support with ~100LoC. [journald conventions][3] for structured field names differ from typical tracing idioms, and journald discards fields which violate its conventions. Hence, this layer automatically sanitizes field names by translating `.`s into `_`s, stripping leading `_`s and non-ascii-alphanumeric characters other than `_`, and upcasing. Levels are mapped losslessly to journald `PRIORITY` values as follows: - `ERROR` => Error (3) - `WARN` => Warning (4) - `INFO` => Notice (5) - `DEBUG` => Informational (6) - `TRACE` => Debug (7) Note that the naming scheme differs slightly for the latter half. The standard journald `CODE_LINE` and `CODE_FILE` fields are automatically emitted. A `TARGET` field is emitted containing the event's target. Enclosing spans are numbered counting up from the root, and their fields and metadata are included in fields prefixed by `Sn_` where `n` is that number. User-defined fields other than the event `message` field have a prefix applied by default to prevent collision with standard fields. [1]: https://www.freedesktop.org/wiki/Software/systemd/export/ [2]: https://systemd-devel.freedesktop.narkive.com/i5tlUyjz/client-logging-to-journald-without-libsystemd-journal-so#post6 [3]: https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html
20 lines
354 B
TOML
20 lines
354 B
TOML
[workspace]
|
|
|
|
members = [
|
|
"tracing",
|
|
"tracing-core",
|
|
"tracing-attributes",
|
|
"tracing-error",
|
|
"tracing-flame",
|
|
"tracing-futures",
|
|
"tracing-tower",
|
|
"tracing-log",
|
|
"tracing-macros",
|
|
"tracing-opentelemetry",
|
|
"tracing-subscriber",
|
|
"tracing-serde",
|
|
"tracing-appender",
|
|
"tracing-journald",
|
|
"examples"
|
|
]
|