mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
Our logging library `tracing` supports structured logging. Structured logging means we can include values within a `tracing::Event` without having to immediately format it as a string. Processing these values - such as errors - as their original type allows the various `tracing` layers to capture and represent them as they see fit. One of these layers is responsible for sending ERROR and WARN events to Sentry, as part of which `std::error::Error` values get automatically captured as so-called "sentry exceptions". Unfortunately, there is a caveat: If an `std::error::Error` value is included in an event that does not get mapped to an exception, the `error` field is completely lost. See https://github.com/getsentry/sentry-rust/issues/702 for details. To work around this, we introduce a `err_with_sources` adapter that an error and all its sources together into a string. For all `tracing::debug!` statements, we then use this to report these errors. It is really unfortunate that we have to do this and cannot use the same mechanism, regardless of the log level. However, until this is fixed upstream, this will do and gives us better information in the log submitted to Sentry.
26 lines
642 B
TOML
26 lines
642 B
TOML
[package]
|
|
name = "firezone-logging"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
authors = ["Firezone, Inc."]
|
|
publish = false
|
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
|
|
[dependencies]
|
|
anyhow = "1"
|
|
nu-ansi-term = { version = "0.50" }
|
|
rand = "0.8"
|
|
sentry-tracing = "0.34.0"
|
|
time = { version = "0.3.36", features = ["formatting"] }
|
|
tracing = { workspace = true }
|
|
tracing-appender = { version = "0.2.2" }
|
|
tracing-log = "0.2"
|
|
tracing-stackdriver = { version = "0.11.0" }
|
|
tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
|
|
|
[dev-dependencies]
|
|
thiserror = "1"
|
|
|
|
[lints]
|
|
workspace = true
|