chore: remove bunyan

This commit is contained in:
Kristofers Solo 2025-09-23 11:28:58 +03:00
parent 6b7cab4032
commit ef3e903a6f
Signed by: kristoferssolo
GPG Key ID: 74FF8144483D82C8
4 changed files with 4 additions and 75 deletions

51
Cargo.lock generated
View File

@ -17,19 +17,6 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "ahash"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
dependencies = [
"cfg-if",
"getrandom",
"once_cell",
"version_check",
"zerocopy",
]
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.1.3" version = "1.1.3"
@ -1752,7 +1739,6 @@ dependencies = [
"tokio", "tokio",
"tracing", "tracing",
"tracing-appender", "tracing-appender",
"tracing-bunyan-formatter",
"tracing-subscriber", "tracing-subscriber",
"url", "url",
] ]
@ -1962,7 +1948,6 @@ version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [ dependencies = [
"log",
"pin-project-lite", "pin-project-lite",
"tracing-attributes", "tracing-attributes",
"tracing-core", "tracing-core",
@ -1991,23 +1976,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "tracing-bunyan-formatter"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d637245a0d8774bd48df6482e086c59a8b5348a910c3b0579354045a9d82411"
dependencies = [
"ahash",
"log",
"serde",
"serde_json",
"time",
"tracing",
"tracing-core",
"tracing-log 0.1.4",
"tracing-subscriber",
]
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.34" version = "0.1.34"
@ -2028,17 +1996,6 @@ dependencies = [
"tracing-subscriber", "tracing-subscriber",
] ]
[[package]]
name = "tracing-log"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2"
dependencies = [
"log",
"once_cell",
"tracing-core",
]
[[package]] [[package]]
name = "tracing-log" name = "tracing-log"
version = "0.2.0" version = "0.2.0"
@ -2065,7 +2022,7 @@ dependencies = [
"thread_local", "thread_local",
"tracing", "tracing",
"tracing-core", "tracing-core",
"tracing-log 0.2.0", "tracing-log",
] ]
[[package]] [[package]]
@ -2133,12 +2090,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version_check"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]] [[package]]
name = "want" name = "want"
version = "0.3.1" version = "0.3.1"

View File

@ -25,13 +25,9 @@ tokio = { version = "1", features = [
] } ] }
tracing = "0.1" tracing = "0.1"
tracing-appender = "0.2" tracing-appender = "0.2"
tracing-bunyan-formatter = { version = "0.3", default-features = false, optional = true }
tracing-subscriber = { version = "0.3", features = ["registry", "env-filter"] } tracing-subscriber = { version = "0.3", features = ["registry", "env-filter"] }
url = "2.5" url = "2.5"
[features]
bunyan = ["tracing-bunyan-formatter"]
[lints.clippy] [lints.clippy]
pedantic = "warn" pedantic = "warn"
nursery = "warn" nursery = "warn"

View File

@ -7,6 +7,7 @@ services:
BINARY_NAME: tg-relay-rs BINARY_NAME: tg-relay-rs
environment: environment:
TELOXIDE_TOKEN: ${TELOXIDE_TOKEN} TELOXIDE_TOKEN: ${TELOXIDE_TOKEN}
YTDLP_FORMAT: ${YTDLP_FORMAT:-best}
COOKIES_PATH: /app/yt-cookies.txt COOKIES_PATH: /app/yt-cookies.txt
RUST_LOG: ${RUST_LOG:-info} RUST_LOG: ${RUST_LOG:-info}
restart: unless-stopped restart: unless-stopped

View File

@ -1,23 +1,8 @@
#[cfg(feature = "bunyan")]
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt}; use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
/// Initialise tracing with bunyan-style JSON output. /// Initialise tracing
#[cfg(feature = "bunyan")]
pub fn setup_logger() { pub fn setup_logger() {
let env_filter = create_env_filter(); let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into());
let formatter = BunyanFormattingLayer::new("tg-relay-rs".into(), std::io::stdout);
tracing_subscriber::registry()
.with(env_filter)
.with(formatter)
.with(JsonStorageLayer)
.init()
}
#[cfg(not(feature = "bunyan"))]
pub fn setup_logger() {
let env_filter = create_env_filter();
let formatter = tracing_subscriber::fmt::Layer::default(); let formatter = tracing_subscriber::fmt::Layer::default();
tracing_subscriber::registry() tracing_subscriber::registry()
@ -25,7 +10,3 @@ pub fn setup_logger() {
.with(formatter) .with(formatter)
.init() .init()
} }
fn create_env_filter() -> EnvFilter {
EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into())
}