Skip to content

Commit

Permalink
feat: remove tracing
Browse files Browse the repository at this point in the history
We don't need very advanced logging and instrumentation.

BREAKING CHANGE: Remove feature "tracing" from mp4-stream crate
  • Loading branch information
Stonks3141 committed Nov 2, 2023
1 parent fe2104b commit 1b99dd2
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 181 deletions.
150 changes: 60 additions & 90 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ hyper = "0.14"
tokio = { version = "1.30", features = ["rt", "macros", "fs", "io-util"] }
futures-lite = "1.13"
flume = "0.10"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-tree = "0.2"
tracing-error = "0.2"
log = "0.4"
env_logger = "0.10"
include_dir = "0.7"
xflags = "0.3"
confy = "0.5"
Expand All @@ -37,7 +35,7 @@ tower-cookies = "0.9"
ring = "0.16"
jsonwebtoken = "8.3"
rust-argon2 = "1.0"
mp4-stream = { path = "crates/mp4-stream", features = ["serde", "tracing"] }
mp4-stream = { path = "crates/mp4-stream", features = ["serde", "log"] }
quick-error = "2.0"
serde = { version = "1.0", features = ["derive"] }
chrono = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion crates/mp4-stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ license.workspace = true
[dependencies]
flume.workspace = true
quick-error.workspace = true
tracing = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
log = { workspace = true, optional = true }
chrono.workspace = true
bitflags.workspace = true
fixed.workspace = true
Expand Down
6 changes: 0 additions & 6 deletions crates/mp4-stream/src/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ struct Resolution {
///
/// This function may return a [`Error::Io`] if interaction with the filesystem
/// fails or a [`Error::Camera`] if the camera returns an error.
#[cfg_attr(feature = "tracing", tracing::instrument(level = "debug"))]
pub fn get_capabilities_all() -> crate::Result<Capabilities> {
let mut caps = HashMap::new();

Expand Down Expand Up @@ -147,7 +146,6 @@ pub fn get_capabilities_all() -> crate::Result<Capabilities> {
///
/// This function may return a [`Error::Io`] if interaction with the filesystem
/// fails or a [`Error::Camera`] if the camera returns an error.
#[cfg_attr(feature = "tracing", tracing::instrument(level = "debug"))]
pub fn get_capabilities_from_path(device: &Path) -> crate::Result<Formats> {
let camera = rscam::Camera::new(
device
Expand All @@ -157,7 +155,6 @@ pub fn get_capabilities_from_path(device: &Path) -> crate::Result<Formats> {
get_capabilities(&camera)
}

#[cfg_attr(feature = "tracing", tracing::instrument(level = "trace", skip_all))]
fn get_capabilities(camera: &rscam::Camera) -> crate::Result<Formats> {
camera
.formats()
Expand All @@ -183,7 +180,6 @@ fn get_capabilities(camera: &rscam::Camera) -> crate::Result<Formats> {
.collect()
}

#[cfg_attr(feature = "tracing", tracing::instrument(level = "trace"))]
fn get_resolutions(resolutions: ResolutionInfo) -> Vec<(u32, u32)> {
match resolutions {
ResolutionInfo::Discretes(r) => r,
Expand All @@ -194,7 +190,6 @@ fn get_resolutions(resolutions: ResolutionInfo) -> Vec<(u32, u32)> {
}
}

#[cfg_attr(feature = "tracing", tracing::instrument(level = "trace"))]
fn get_intervals(intervals: IntervalInfo) -> Vec<(u32, u32)> {
match intervals {
IntervalInfo::Discretes(r) => r,
Expand All @@ -213,7 +208,6 @@ fn get_intervals(intervals: IntervalInfo) -> Vec<(u32, u32)> {
///
/// This function may return a [`Error::Other`] if any part of the config is invalid,
/// including the V4L2 controls.
#[cfg_attr(feature = "tracing", tracing::instrument(level = "debug", skip(caps)))]
pub fn check_config(config: &Config, caps: &Capabilities) -> crate::Result<()> {
caps.0
.get(&config.device)
Expand Down
Loading

0 comments on commit 1b99dd2

Please sign in to comment.