diff --git a/Cargo.toml b/Cargo.toml index 4ebf8ce..bc1f690 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["log", "netfetch", "daqingest"] +members = ["netfetch", "daqingest"] resolver = "2" [profile.release] diff --git a/batchtools/Cargo.toml b/batchtools/Cargo.toml index 7adf462..b0134ba 100644 --- a/batchtools/Cargo.toml +++ b/batchtools/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" doctest = false [dependencies] -log = { path = "../log" } +log = { path = "../../daqbuf-log", package = "log" } err = { path = "../../daqbuf-err", package = "daqbuf-err" } taskrun = { path = "../../daqbuffer/crates/taskrun" } async-channel = "2.1.0" diff --git a/daqingest/Cargo.toml b/daqingest/Cargo.toml index 5a244bc..9d817e7 100644 --- a/daqingest/Cargo.toml +++ b/daqingest/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "daqingest" -version = "0.3.0-aa.6" +version = "0.3.0-aa.7" authors = ["Dominik Werder "] edition = "2024" @@ -26,7 +26,7 @@ netpod = { path = "../../daqbuf-netpod", package = "daqbuf-netpod" } taskrun = { path = "../../daqbuffer/crates/taskrun" } series = { path = "../../daqbuf-series", package = "daqbuf-series" } channeltools = { path = "../../daqbuf-channeltools", package = "daqbuf-channeltools" } -log = { path = "../log" } +log = { path = "../../daqbuf-log", package = "log" } stats = { path = "../stats" } scywr = { path = "../scywr" } dbpg = { path = "../dbpg" } diff --git a/dbpg/Cargo.toml b/dbpg/Cargo.toml index ba4b0b2..b6ffd09 100644 --- a/dbpg/Cargo.toml +++ b/dbpg/Cargo.toml @@ -8,7 +8,7 @@ edition = "2024" doctest = false [dependencies] -log = { path = "../log" } +log = { path = "../../daqbuf-log", package = "log" } err = { path = "../../daqbuf-err", package = "daqbuf-err" } netpod = { path = "../../daqbuf-netpod", package = "daqbuf-netpod" } taskrun = { path = "../../daqbuffer/crates/taskrun" } diff --git a/ingest-linux/Cargo.toml b/ingest-linux/Cargo.toml index d5d09b9..e98b2c4 100644 --- a/ingest-linux/Cargo.toml +++ b/ingest-linux/Cargo.toml @@ -7,5 +7,5 @@ edition = "2024" [dependencies] libc = "0.2" autoerr = "0.0" -log = { path = "../log" } +log = { path = "../../daqbuf-log", package = "log" } taskrun = { path = "../../daqbuffer/crates/taskrun" } diff --git a/log/Cargo.toml b/log/Cargo.toml deleted file mode 100644 index 311de91..0000000 --- a/log/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "log" -version = "0.0.2" -authors = ["Dominik Werder "] -edition = "2024" - -[lib] -path = "src/log.rs" - -[dependencies] -tracing = "0.1" diff --git a/log/src/log.rs b/log/src/log.rs deleted file mode 100644 index 1d599ba..0000000 --- a/log/src/log.rs +++ /dev/null @@ -1,167 +0,0 @@ -#![allow(unused_imports)] - -pub use branch_debug as debug; -pub use branch_error as error; -pub use branch_info as info; -pub use branch_trace as trace; -pub use branch_warn as warn; - -use std::sync::LazyLock; - -#[allow(unused)] -#[inline(always)] -pub fn is_log_direct() -> bool { - static ONCE: LazyLock = - LazyLock::new(|| std::env::var("LOG_DIRECT").map_or(false, |x| x.parse().unwrap_or(false))); - *ONCE -} - -pub mod log_tracing { - pub use tracing::debug; - pub use tracing::error; - pub use tracing::info; - pub use tracing::trace; - pub use tracing::warn; - // pub use tracing::{self, event, span, Level}; -} - -pub mod log_direct { - #[allow(unused)] - #[macro_export] - macro_rules! direct_trace { - ($fmt:expr) => { - eprintln!("TRACE {}", format_args!($fmt)); - }; - ($fmt:expr, $($arg:tt)*) => { - eprintln!("TRACE {}", format_args!($fmt, $($arg)*)); - }; - } - #[allow(unused)] - #[macro_export] - macro_rules! direct_debug { - ($fmt:expr) => { - // eprintln!(concat!("DEBUG ", $fmt)); - // eprintln!("{}", format_args!(concat!("DEBUG ", $fmt))); - eprintln!("DEBUG {}", format_args!($fmt)); - }; - ($fmt:expr, $($arg:expr),*) => { - // eprintln!(concat!("DEBUG ", $fmt), $($arg),*); - // eprintln!("{}", format_args!(concat!("DEBUG ", $fmt), $($arg),*)); - eprintln!("DEBUG {}", format_args!($fmt, $($arg),*)); - }; - } - #[allow(unused)] - #[macro_export] - macro_rules! direct_info { - ($fmt:expr) => { - eprintln!("INFO {}", format_args!($fmt)); - }; - ($fmt:expr, $($arg:expr),*) => { - eprintln!("INFO {}", format_args!($fmt, $($arg),*)); - }; - } - #[allow(unused)] - #[macro_export] - macro_rules! direct_warn { - ($fmt:expr) => { - eprintln!("WARN {}", format_args!($fmt)); - }; - ($fmt:expr, $($arg:expr),*) => { - eprintln!("WARN {}", format_args!($fmt, $($arg),*)); - }; - } - #[allow(unused)] - #[macro_export] - macro_rules! direct_error { - ($fmt:expr) => { - eprintln!("ERROR {}", format_args!($fmt)); - }; - ($fmt:expr, $($arg:expr),*) => { - eprintln!("ERROR {}", format_args!($fmt, $($arg),*)); - }; - } - pub use crate::direct_debug as debug; - pub use crate::direct_error as error; - pub use crate::direct_info as info; - pub use crate::direct_trace as trace; - pub use crate::direct_warn as warn; -} - -#[allow(unused)] -#[macro_export] -macro_rules! log_v2_trace { - // ($fmt:expr) => { - // let h = format_args!(); - // eprintln!(concat!("TRACE V2 ", $fmt)); - // }; - ($fmt:expr, $($arg:expr),*) => { - // let fmt2 = concat!("", $fmt); - // let fmt2 = concat!("TRACE V2 ", $fmt, $($arg),*); - // let h = format_args!($fmt, $($arg),*); - // eprintln!("h: {:?}", h); - }; -} - -pub mod log_macros_branch { - #[allow(unused)] - #[macro_export] - macro_rules! branch_trace { - ($($arg:tt)*) => { - if $crate::is_log_direct() { - $crate::log_direct::trace!($($arg)*); - } else { - $crate::log_tracing::trace!($($arg)*); - } - }; - } - #[allow(unused)] - #[macro_export] - macro_rules! branch_debug { - ($($arg:tt)*) => { - if $crate::is_log_direct() { - $crate::log_direct::debug!($($arg)*); - } else { - $crate::log_tracing::debug!($($arg)*); - } - }; - } - #[allow(unused)] - #[macro_export] - macro_rules! branch_info { - ($($arg:tt)*) => { - if $crate::is_log_direct() { - $crate::log_direct::info!($($arg)*); - } else { - $crate::log_tracing::info!($($arg)*); - } - }; - } - #[allow(unused)] - #[macro_export] - macro_rules! branch_warn { - ($($arg:tt)*) => { - if $crate::is_log_direct() { - $crate::log_direct::warn!($($arg)*); - } else { - $crate::log_tracing::warn!($($arg)*); - } - }; - } - #[allow(unused)] - #[macro_export] - macro_rules! branch_error { - ($($arg:tt)*) => { - if $crate::is_log_direct() { - $crate::log_direct::error!($($arg)*); - } else { - $crate::log_tracing::error!($($arg)*); - } - }; - } - pub use branch_debug as debug; - pub use branch_error as error; - pub use branch_info as info; - pub use branch_trace as trace; - pub use branch_warn as warn; - pub use tracing::{self, Level, event, span}; -} diff --git a/mrucache/Cargo.toml b/mrucache/Cargo.toml index 7a80b61..a306a15 100644 --- a/mrucache/Cargo.toml +++ b/mrucache/Cargo.toml @@ -6,4 +6,4 @@ authors = ["Dominik Werder "] [dependencies] hashbrown = "0.15.2" -log = { path = "../log" } +log = { path = "../../daqbuf-log", package = "log" } diff --git a/netfetch/Cargo.toml b/netfetch/Cargo.toml index 5c03672..902752c 100644 --- a/netfetch/Cargo.toml +++ b/netfetch/Cargo.toml @@ -38,7 +38,7 @@ dashmap = "6.0.1" hashbrown = "0.15.2" smallvec = "1.13.2" autoerr = "0.0" -log = { path = "../log" } +log = { path = "../../daqbuf-log", package = "log" } series = { path = "../../daqbuf-series", package = "daqbuf-series" } serieswriter = { path = "../serieswriter" } stats = { path = "../stats" } diff --git a/netfetch/src/ca/conn.rs b/netfetch/src/ca/conn.rs index 26410eb..8db0f3c 100644 --- a/netfetch/src/ca/conn.rs +++ b/netfetch/src/ca/conn.rs @@ -2394,23 +2394,24 @@ impl CaConn { Self::check_ev_value_data(&value.data, &writer.scalar_type())?; crst.muted_before = 0; crst.insert_item_ivl_ema.tick(tsnow); - if binwriter_enable { - binwriter.ingest(tsev, value.f32_for_binning(), iqdqs)?; + let val_for_agg = value.f32_for_binning(); + let wres = writer.write(CaWriterValue::new(value, crst), tscaproto, tsev, iqdqs)?; + crst.status_emit_count += wres.nstatus() as u64; + if wres.st.accept { + crst.dw_st_last = stnow; + crst.acc_st.push_written(payload_len); } - { - let wres = writer.write(CaWriterValue::new(value, crst), tscaproto, tsev, iqdqs)?; - crst.status_emit_count += wres.nstatus() as u64; - if wres.st.accept { - crst.dw_st_last = stnow; - crst.acc_st.push_written(payload_len); - } - if wres.mt.accept { - crst.dw_mt_last = stnow; - crst.acc_mt.push_written(payload_len); - } - if wres.lt.accept { - crst.dw_lt_last = stnow; - crst.acc_lt.push_written(payload_len); + if wres.mt.accept { + crst.dw_mt_last = stnow; + crst.acc_mt.push_written(payload_len); + } + if wres.lt.accept { + crst.dw_lt_last = stnow; + crst.acc_lt.push_written(payload_len); + } + if binwriter_enable { + if true || wres.accept_any() { + binwriter.ingest(tsev, val_for_agg, iqdqs)?; } } } diff --git a/scywr/Cargo.toml b/scywr/Cargo.toml index ce12d43..f56da13 100644 --- a/scywr/Cargo.toml +++ b/scywr/Cargo.toml @@ -13,7 +13,7 @@ pin-project = "1.1.5" bytes = "1.10.0" autoerr = "0.0" serde = { version = "1", features = ["derive"] } -log = { path = "../log" } +log = { path = "../../daqbuf-log", package = "log" } stats = { path = "../stats" } series = { path = "../../daqbuf-series", package = "daqbuf-series" } netpod = { path = "../../daqbuf-netpod", package = "daqbuf-netpod" } diff --git a/serieswriter/Cargo.toml b/serieswriter/Cargo.toml index b07092c..c645837 100644 --- a/serieswriter/Cargo.toml +++ b/serieswriter/Cargo.toml @@ -11,7 +11,7 @@ futures-util = "0.3.30" smallvec = "1.13.2" autoerr = "0.0" itertools = "0.14" -log = { path = "../log" } +log = { path = "../../daqbuf-log", package = "log" } netpod = { path = "../../daqbuf-netpod", package = "daqbuf-netpod" } items_0 = { path = "../../daqbuf-items-0", package = "daqbuf-items-0" } items_2 = { path = "../../daqbuf-items-2", package = "daqbuf-items-2" } diff --git a/stats/Cargo.toml b/stats/Cargo.toml index 642e577..06e0f25 100644 --- a/stats/Cargo.toml +++ b/stats/Cargo.toml @@ -12,6 +12,6 @@ serde = { version = "1", features = ["derive"] } rand_xoshiro = "0.7.0" stats_types = { path = "../stats_types" } stats_proc = { path = "../stats_proc" } -log = { path = "../log" } +log = { path = "../../daqbuf-log", package = "log" } mettrics = { version = "0.0.7", path = "../../mettrics" } ca_proto = { path = "../../daqbuf-ca-proto", package = "daqbuf-ca-proto" }