diff --git a/Cargo.toml b/Cargo.toml
index ec5c9860..0ec1f9a5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -83,9 +83,6 @@ futures-lite = "2.3"
futuredsp = { path = "crates/futuredsp", version = "0.0.6" }
futuresdr-macros = { path = "crates/macros", version = "0.0.6" }
futuresdr-types = { path = "crates/types", version = "0.0.11" }
-# they broke additive features in 0.4.22
-# https://github.com/rust-lang/log/issues/635
-log = { version = "=0.4.21", features = ["std", "max_level_debug", "release_max_level_info"] }
num-complex = "0.4"
num-integer = "0.1"
num_cpus = "1.16"
@@ -97,19 +94,20 @@ slab = "0.4"
spin = "0.9"
serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0"
+tracing = { version = "0.1", features = ["log", "max_level_debug", "release_max_level_info"] }
web-time = { version = "1.1" }
wgpu = { version = "0.20", optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies]
-console_log = "1.0"
cpal = { version = "0.15", optional = true, features = ['wasm-bindgen'] }
getrandom = { version = "0.2", features = ["js"] }
gloo-net = {version = "0.5", default-features = false, features = ["websocket", "json"]}
gloo-timers = { version = "0.3", features = ["futures"] }
js-sys = "0.3"
-rodio = { version = "0.18", default-features = false, optional = true }
+rodio = { version = "0.19", default-features = false, optional = true }
serde-wasm-bindgen = "0.6"
serde_json = "1.0"
+tracing-wasm = "0.2"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
@@ -129,9 +127,10 @@ core_affinity = "0.8"
cpal = { version = "0.15", optional = true }
hound = {version = "3.5", optional = true }
libc = "0.2"
-rodio = { version = "0.18", default-features = false, features = ["symphonia-all"], optional = true }
+rodio = { version = "0.19", default-features = false, features = ["symphonia-all"], optional = true }
tokio = { version = "1", features = ["rt"] }
tower-http = { version = "0.5", features = ["add-extension", "cors", "fs"] }
+tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
vmcircbuffer = "0.0.10"
vulkano = { version = "0.34", optional = true }
vulkano-shaders = { version = "0.34", optional = true }
@@ -142,7 +141,7 @@ lttng-ust = { git = "https://github.com/sprt/lttng-ust-rs.git", version = "0.1.0
xilinx-dma = { version = "0.0.10", features = ["async"], optional = true }
[target.'cfg(target_os = "android")'.dependencies]
-android_logger = "0.13"
+android_logger = "0.14"
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
version = "0.3"
diff --git a/crates/prophecy/Cargo.toml b/crates/prophecy/Cargo.toml
index d3283071..24a96e9a 100644
--- a/crates/prophecy/Cargo.toml
+++ b/crates/prophecy/Cargo.toml
@@ -9,7 +9,6 @@ description = "FutureSDR GUI"
[dependencies]
console_error_panic_hook = "0.1"
-console_log = "1"
futures = "0.3"
futuresdr = { version = "0.0.37", path = "../../" }
futuresdr-types = { version = "0.0.11", path = "../types/" }
diff --git a/crates/prophecy/src/main.rs b/crates/prophecy/src/main.rs
index 775c17fd..cd950553 100644
--- a/crates/prophecy/src/main.rs
+++ b/crates/prophecy/src/main.rs
@@ -299,7 +299,6 @@ pub fn Prophecy() -> impl IntoView {
}
pub fn main() {
- _ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| view! { })
}
diff --git a/examples/adsb/Cargo.toml b/examples/adsb/Cargo.toml
index 8693e033..c3484246 100644
--- a/examples/adsb/Cargo.toml
+++ b/examples/adsb/Cargo.toml
@@ -16,10 +16,9 @@ rtlsdr = ["futuresdr/rtlsdr"]
soapy = ["futuresdr/soapy"]
[dependencies]
+adsb_deku = "0.7"
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../..", features = ["seify"] }
serde = { version = "1", features = ["derive"] }
-serde_with = "3"
serde_json = "1"
-env_logger = "0.11"
-adsb_deku = "0.7"
+serde_with = "3"
diff --git a/examples/adsb/src/bin/listen_adsb.rs b/examples/adsb/src/bin/listen_adsb.rs
index 60d6cb75..6996db8b 100644
--- a/examples/adsb/src/bin/listen_adsb.rs
+++ b/examples/adsb/src/bin/listen_adsb.rs
@@ -10,11 +10,11 @@ use futuresdr::blocks::Apply;
use futuresdr::blocks::FileSource;
use futuresdr::blocks::FirBuilder;
use futuresdr::blocks::Throttle;
-use futuresdr::log::{warn, LevelFilter};
use futuresdr::num_complex::Complex32;
use futuresdr::num_integer;
use futuresdr::runtime::Flowgraph;
use futuresdr::runtime::Runtime;
+use futuresdr::tracing::warn;
use std::time::Duration;
#[derive(Parser, Debug)]
@@ -56,11 +56,9 @@ fn sample_rate_parser(sample_rate_str: &str) -> Result {
}
fn main() -> Result<()> {
- let mut builder = env_logger::Builder::from_default_env();
- builder.filter(None, LevelFilter::Info).init();
-
let args = Args::parse();
let mut fg = Flowgraph::new();
+ futuresdr::runtime::init();
let src = match args.file {
Some(f) => {
diff --git a/examples/adsb/src/decoder.rs b/examples/adsb/src/decoder.rs
index bac80dc3..8d2fea3f 100644
--- a/examples/adsb/src/decoder.rs
+++ b/examples/adsb/src/decoder.rs
@@ -1,7 +1,6 @@
use crate::DemodPacket;
use adsb_deku::deku::DekuContainerRead;
use futuresdr::anyhow::{bail, Result};
-use futuresdr::log::{debug, info, warn};
use futuresdr::macros::async_trait;
use futuresdr::macros::message_handler;
use futuresdr::runtime::Block;
@@ -13,6 +12,7 @@ use futuresdr::runtime::MessageIoBuilder;
use futuresdr::runtime::Pmt;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::{debug, info, warn};
use serde::Serialize;
use std::time::SystemTime;
diff --git a/examples/adsb/src/tracker.rs b/examples/adsb/src/tracker.rs
index 05d96a0a..d0d4bda4 100644
--- a/examples/adsb/src/tracker.rs
+++ b/examples/adsb/src/tracker.rs
@@ -1,6 +1,5 @@
use futuresdr::anyhow::Result;
use futuresdr::async_io::Timer;
-use futuresdr::log::{info, warn};
use futuresdr::macros::async_trait;
use futuresdr::macros::message_handler;
use futuresdr::runtime::Block;
@@ -13,6 +12,7 @@ use futuresdr::runtime::Pmt;
use futuresdr::runtime::StreamIo;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::{info, warn};
use std::cmp::Ordering;
use std::time::Duration;
diff --git a/examples/android-hw/src/lib.rs b/examples/android-hw/src/lib.rs
index 253da97b..4af7554b 100644
--- a/examples/android-hw/src/lib.rs
+++ b/examples/android-hw/src/lib.rs
@@ -11,10 +11,10 @@ use futuresdr::blocks::Apply;
use futuresdr::blocks::Fft;
use futuresdr::blocks::WebsocketSinkBuilder;
use futuresdr::blocks::WebsocketSinkMode;
-use futuresdr::log::info;
use futuresdr::num_complex::Complex32;
use futuresdr::runtime::Flowgraph;
use futuresdr::runtime::Runtime;
+use futuresdr::tracing::info;
pub fn run_fg() -> Result<()> {
futuresdr::runtime::init();
diff --git a/examples/android/src/lib.rs b/examples/android/src/lib.rs
index 398f70c9..6b2b5c21 100644
--- a/examples/android/src/lib.rs
+++ b/examples/android/src/lib.rs
@@ -7,12 +7,12 @@ use futuresdr::blocks::VectorSink;
use futuresdr::blocks::VectorSinkBuilder;
use futuresdr::blocks::VectorSource;
use futuresdr::blocks::VulkanBuilder;
-use futuresdr::log::info;
use futuresdr::runtime::buffer::vulkan::Broker;
use futuresdr::runtime::buffer::vulkan::D2H;
use futuresdr::runtime::buffer::vulkan::H2D;
use futuresdr::runtime::Flowgraph;
use futuresdr::runtime::Runtime;
+use futuresdr::tracing::info;
pub fn run_fg() -> Result<()> {
let mut fg = Flowgraph::new();
diff --git a/examples/cw/Cargo.toml b/examples/cw/Cargo.toml
index 77f9bf91..5faef48e 100644
--- a/examples/cw/Cargo.toml
+++ b/examples/cw/Cargo.toml
@@ -16,5 +16,4 @@ clap = { version = "4", features = ["derive"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
-console_log = "1"
leptos = { version = "0.6", features = ["csr", "nightly"] }
diff --git a/examples/cw/src/bin/tx.rs b/examples/cw/src/bin/tx.rs
index f21a553c..36e9782d 100644
--- a/examples/cw/src/bin/tx.rs
+++ b/examples/cw/src/bin/tx.rs
@@ -58,7 +58,6 @@ mod foo {
pub fn main() -> Result<()> {
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
- console_log::init().expect("could not initialize logger");
mount_to_body(|| view! { });
Ok(())
}
diff --git a/examples/egui/Cargo.toml b/examples/egui/Cargo.toml
index c8591428..d9c3ff05 100644
--- a/examples/egui/Cargo.toml
+++ b/examples/egui/Cargo.toml
@@ -14,11 +14,7 @@ aaronia_http = ["futuresdr/aaronia_http"]
soapy = ["futuresdr/soapy"]
[dependencies]
-eframe = "0.27"
-env_logger = { version = "0.11", default-features = false, features = [
- "auto-color",
- "humantime",
-] }
+eframe = "0.28"
futuresdr = { path = "../..", features = ["seify"] }
futuresdr-remote = { path = "../../crates/remote/" }
tokio = { version = "1", features = ["full"] }
diff --git a/examples/egui/src/bin/combined.rs b/examples/egui/src/bin/combined.rs
index cfc43e66..cf1631c0 100644
--- a/examples/egui/src/bin/combined.rs
+++ b/examples/egui/src/bin/combined.rs
@@ -23,7 +23,7 @@ use futuresdr_egui::ChannelSink;
use futuresdr_egui::FFT_SIZE;
fn main() -> Result<(), eframe::Error> {
- env_logger::init();
+ futuresdr::runtime::init();
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([900.0, 600.0]),
multisampling: 4,
@@ -33,7 +33,7 @@ fn main() -> Result<(), eframe::Error> {
eframe::run_native(
"FutureSDR + egui",
options,
- Box::new(|cc| Box::new(MyApp::new(cc))),
+ Box::new(|cc| Ok(Box::new(MyApp::new(cc)))),
)
}
diff --git a/examples/egui/src/bin/egui.rs b/examples/egui/src/bin/egui.rs
index 3088bae8..897bb962 100644
--- a/examples/egui/src/bin/egui.rs
+++ b/examples/egui/src/bin/egui.rs
@@ -21,7 +21,7 @@ use tungstenite::Message;
use futuresdr_egui::FFT_SIZE;
fn main() -> Result<(), eframe::Error> {
- env_logger::init();
+ futuresdr::runtime::init();
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([900.0, 600.0]),
multisampling: 4,
@@ -31,7 +31,7 @@ fn main() -> Result<(), eframe::Error> {
eframe::run_native(
"FutureSDR + egui",
options,
- Box::new(|cc| Box::new(MyApp::new(cc))),
+ Box::new(|cc| Ok(Box::new(MyApp::new(cc)))),
)
}
diff --git a/examples/keyfob/src/decoder.rs b/examples/keyfob/src/decoder.rs
index 8922c068..264eb743 100644
--- a/examples/keyfob/src/decoder.rs
+++ b/examples/keyfob/src/decoder.rs
@@ -1,5 +1,4 @@
use futuresdr::anyhow::Result;
-use futuresdr::log::info;
use futuresdr::macros::async_trait;
use futuresdr::runtime::Block;
use futuresdr::runtime::BlockMeta;
@@ -10,6 +9,7 @@ use futuresdr::runtime::MessageIoBuilder;
use futuresdr::runtime::StreamIo;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::info;
#[derive(Debug)]
enum State {
diff --git a/examples/logging/Cargo.toml b/examples/logging/Cargo.toml
index 471b1b44..1f71af33 100644
--- a/examples/logging/Cargo.toml
+++ b/examples/logging/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
futuresdr = { path = "../.." }
-env_logger = "0.11"
+tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }
[[bin]]
name = "logging"
diff --git a/examples/logging/logging.rs b/examples/logging/logging.rs
index 9f5d042f..b9556a56 100644
--- a/examples/logging/logging.rs
+++ b/examples/logging/logging.rs
@@ -1,17 +1,29 @@
-use env_logger::Builder;
-use std::time;
-
use futuresdr::anyhow::Result;
use futuresdr::blocks::MessageSourceBuilder;
-use futuresdr::log::info;
-use futuresdr::log::LevelFilter;
use futuresdr::runtime::Flowgraph;
use futuresdr::runtime::Pmt;
use futuresdr::runtime::Runtime;
+use futuresdr::tracing::info;
+use futuresdr::tracing::level_filters::LevelFilter;
+use std::time;
+use tracing_subscriber::filter::EnvFilter;
+use tracing_subscriber::fmt;
+use tracing_subscriber::prelude::*;
fn main() -> Result<()> {
- let mut builder = Builder::from_default_env();
- builder.filter(None, LevelFilter::Info).init();
+ let format = fmt::layer()
+ .with_level(true)
+ .with_target(true)
+ .with_thread_ids(true)
+ .with_thread_names(true)
+ .compact();
+
+ let filter = EnvFilter::from_env("FOO_LOG").add_directive(LevelFilter::DEBUG.into());
+
+ tracing_subscriber::registry()
+ .with(filter)
+ .with(format)
+ .init();
let mut fg = Flowgraph::new();
diff --git a/examples/rattlegram/Cargo.toml b/examples/rattlegram/Cargo.toml
index 7f1315ea..04817e45 100644
--- a/examples/rattlegram/Cargo.toml
+++ b/examples/rattlegram/Cargo.toml
@@ -21,7 +21,6 @@ hound = "3.5"
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
-console_log = "1"
gloo-timers = { version = "0.3", features = ["futures"] }
leptos = { version = "0.6", features = ["csr", "nightly"] }
wasm-bindgen-futures = "0.4"
diff --git a/examples/rattlegram/src/decoder.rs b/examples/rattlegram/src/decoder.rs
index a1433149..7e5d0b1e 100644
--- a/examples/rattlegram/src/decoder.rs
+++ b/examples/rattlegram/src/decoder.rs
@@ -1,5 +1,4 @@
use futuresdr::anyhow::Result;
-use futuresdr::log::info;
use futuresdr::macros::async_trait;
use futuresdr::num_complex::Complex32;
use futuresdr::runtime::Block;
@@ -11,6 +10,7 @@ use futuresdr::runtime::MessageIoBuilder;
use futuresdr::runtime::StreamIo;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::info;
use rustfft::Fft;
use rustfft::FftPlanner;
use std::sync::Arc;
diff --git a/examples/rattlegram/src/wasm.rs b/examples/rattlegram/src/wasm.rs
index 260a028b..7836212c 100644
--- a/examples/rattlegram/src/wasm.rs
+++ b/examples/rattlegram/src/wasm.rs
@@ -2,10 +2,10 @@ use futuresdr::anyhow::Result;
use futuresdr::blocks::audio::AudioSink;
use futuresdr::blocks::ChannelSource;
use futuresdr::futures::channel::mpsc;
-use futuresdr::log::warn;
use futuresdr::macros::connect;
use futuresdr::runtime::Flowgraph;
use futuresdr::runtime::Runtime;
+use futuresdr::tracing::warn;
use gloo_timers::future::TimeoutFuture;
use leptos::html::Input;
use leptos::*;
@@ -21,7 +21,6 @@ extern "C" {
}
pub fn wasm_main() {
- _ = console_log::init_with_level(futuresdr::log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| view! { })
}
diff --git a/examples/rattlegram/src/wasm_decoder.rs b/examples/rattlegram/src/wasm_decoder.rs
index b033175b..d3ac1a55 100644
--- a/examples/rattlegram/src/wasm_decoder.rs
+++ b/examples/rattlegram/src/wasm_decoder.rs
@@ -1,4 +1,4 @@
-use futuresdr::log::info;
+use futuresdr::tracing::info;
use web_sys::wasm_bindgen;
use web_sys::wasm_bindgen::prelude::*;
@@ -25,7 +25,6 @@ pub enum DecoderMessage {
#[wasm_bindgen]
impl WasmDecoder {
pub fn new() -> Self {
- _ = console_log::init_with_level(futuresdr::log::Level::Debug);
console_error_panic_hook::set_once();
Self {
samples: Vec::new(),
diff --git a/examples/spectrum/Cargo.toml b/examples/spectrum/Cargo.toml
index f1161f70..6b56415b 100644
--- a/examples/spectrum/Cargo.toml
+++ b/examples/spectrum/Cargo.toml
@@ -31,7 +31,6 @@ wasm-bindgen-futures = "0.4"
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
-console_log = "1"
gloo-net = "0.5"
leptos = { version = "0.6", features = ["csr", "nightly"] }
log = "0.4"
diff --git a/examples/spectrum/src/vulkan.rs b/examples/spectrum/src/vulkan.rs
index 39b3545d..6738340b 100644
--- a/examples/spectrum/src/vulkan.rs
+++ b/examples/spectrum/src/vulkan.rs
@@ -15,7 +15,6 @@ use vulkano::pipeline::PipelineBindPoint;
use vulkano::sync::{self, GpuFuture};
use futuresdr::anyhow::{Context, Result};
-use futuresdr::log::debug;
use futuresdr::macros::async_trait;
use futuresdr::runtime::buffer::vulkan::Broker;
use futuresdr::runtime::buffer::vulkan::BufferEmpty;
@@ -31,6 +30,7 @@ use futuresdr::runtime::MessageIoBuilder;
use futuresdr::runtime::StreamIo;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::debug;
#[allow(clippy::needless_question_mark)]
#[allow(deprecated)]
diff --git a/examples/spectrum/src/wasm/frontend.rs b/examples/spectrum/src/wasm/frontend.rs
index a8ea1b3e..704f70ea 100644
--- a/examples/spectrum/src/wasm/frontend.rs
+++ b/examples/spectrum/src/wasm/frontend.rs
@@ -204,7 +204,6 @@ pub fn Gui() -> impl IntoView {
}
pub fn frontend() {
- _ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| view! { })
}
diff --git a/examples/spectrum/src/wasm/web.rs b/examples/spectrum/src/wasm/web.rs
index c9cfbbb4..d0f93471 100644
--- a/examples/spectrum/src/wasm/web.rs
+++ b/examples/spectrum/src/wasm/web.rs
@@ -207,7 +207,6 @@ pub fn Gui() -> impl IntoView {
}
pub fn web() {
- _ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| view! { })
}
diff --git a/examples/wasm/Cargo.toml b/examples/wasm/Cargo.toml
index 635374ec..1e6906a7 100644
--- a/examples/wasm/Cargo.toml
+++ b/examples/wasm/Cargo.toml
@@ -14,7 +14,6 @@ rand = "0.8"
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
-console_log = { version = "1.0", features = ["color"] }
getrandom = { version = "0.2", features = ["js"] }
wasm-bindgen-futures = "0.4"
diff --git a/examples/wasm/src/bin/flowgraph.rs b/examples/wasm/src/bin/flowgraph.rs
index 2ff815c6..634ccec2 100644
--- a/examples/wasm/src/bin/flowgraph.rs
+++ b/examples/wasm/src/bin/flowgraph.rs
@@ -6,7 +6,6 @@ fn main() -> futuresdr::anyhow::Result<()> {
#[cfg(target_arch = "wasm32")]
pub fn main() {
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
- console_log::init().expect("could not initialize logger");
wasm_bindgen_futures::spawn_local(async {
wasm::run().await.unwrap();
});
diff --git a/examples/wasm/src/lib.rs b/examples/wasm/src/lib.rs
index 939c474a..8cb24fcb 100644
--- a/examples/wasm/src/lib.rs
+++ b/examples/wasm/src/lib.rs
@@ -5,9 +5,9 @@ use futuresdr::blocks::Apply;
use futuresdr::blocks::VectorSink;
use futuresdr::blocks::VectorSinkBuilder;
use futuresdr::blocks::VectorSource;
-use futuresdr::log::info;
use futuresdr::runtime::Flowgraph;
use futuresdr::runtime::Runtime;
+use futuresdr::tracing::info;
pub async fn run() -> Result<()> {
let n_items = 100_000;
diff --git a/examples/wgpu/Cargo.toml b/examples/wgpu/Cargo.toml
index 9442fa50..02655051 100644
--- a/examples/wgpu/Cargo.toml
+++ b/examples/wgpu/Cargo.toml
@@ -18,7 +18,6 @@ rand = "0.8"
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
-console_log = { version = "1.0", features = ["color"] }
getrandom = { version = "0.2", features = ["js"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
diff --git a/examples/wgpu/src/lib.rs b/examples/wgpu/src/lib.rs
index 3fa9395c..b9cddce7 100644
--- a/examples/wgpu/src/lib.rs
+++ b/examples/wgpu/src/lib.rs
@@ -4,10 +4,10 @@ use futuresdr::anyhow::{Context, Result};
use futuresdr::blocks::VectorSink;
use futuresdr::blocks::VectorSource;
use futuresdr::blocks::Wgpu;
-use futuresdr::log::info;
use futuresdr::runtime::buffer::wgpu;
use futuresdr::runtime::Flowgraph;
use futuresdr::runtime::Runtime;
+use futuresdr::tracing::info;
pub async fn run() {
run_inner().await.unwrap()
diff --git a/examples/wgpu/src/loopback.rs b/examples/wgpu/src/loopback.rs
index e96c1d95..743c62f5 100644
--- a/examples/wgpu/src/loopback.rs
+++ b/examples/wgpu/src/loopback.rs
@@ -7,7 +7,6 @@ fn main() {
#[cfg(target_arch = "wasm32")]
pub fn main() {
- _ = console_log::init_with_level(futuresdr::log::Level::Debug);
console_error_panic_hook::set_once();
wasm_bindgen_futures::spawn_local(run());
}
diff --git a/examples/wlan/Cargo.toml b/examples/wlan/Cargo.toml
index 8d0f4923..ea2a786e 100644
--- a/examples/wlan/Cargo.toml
+++ b/examples/wlan/Cargo.toml
@@ -32,7 +32,6 @@ rand_distr = "0.4"
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
-console_log = "1"
gloo-net = "0.5"
leptos = { version = "0.6", features = ["csr", "nightly"] }
log = "0.4"
diff --git a/examples/wlan/src/decoder.rs b/examples/wlan/src/decoder.rs
index a4b48730..cc3a7806 100644
--- a/examples/wlan/src/decoder.rs
+++ b/examples/wlan/src/decoder.rs
@@ -1,5 +1,4 @@
use futuresdr::anyhow::Result;
-use futuresdr::log::warn;
use futuresdr::macros::async_trait;
use futuresdr::runtime::Block;
use futuresdr::runtime::BlockMeta;
@@ -13,6 +12,7 @@ use futuresdr::runtime::StreamIo;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::Tag;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::warn;
use crate::Mcs;
use crate::MAX_ENCODED_BITS;
diff --git a/examples/wlan/src/encoder.rs b/examples/wlan/src/encoder.rs
index c65c7fec..6564c3b6 100644
--- a/examples/wlan/src/encoder.rs
+++ b/examples/wlan/src/encoder.rs
@@ -4,7 +4,6 @@ use crate::MAX_ENCODED_BITS;
use crate::MAX_PSDU_SIZE;
use futuresdr::anyhow::Result;
-use futuresdr::log::warn;
use futuresdr::macros::async_trait;
use futuresdr::macros::message_handler;
use futuresdr::runtime::Block;
@@ -18,6 +17,7 @@ use futuresdr::runtime::StreamIo;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::Tag;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::warn;
use std::collections::VecDeque;
/// Maximum number of frames to queue for transmission
diff --git a/examples/wlan/src/frame_equalizer.rs b/examples/wlan/src/frame_equalizer.rs
index 185b94de..482e2802 100644
--- a/examples/wlan/src/frame_equalizer.rs
+++ b/examples/wlan/src/frame_equalizer.rs
@@ -6,7 +6,6 @@ use crate::LONG;
use crate::POLARITY;
use futuresdr::anyhow::Result;
-use futuresdr::log::info;
use futuresdr::macros::async_trait;
use futuresdr::num_complex::Complex32;
use futuresdr::runtime::Block;
@@ -21,6 +20,7 @@ use futuresdr::runtime::StreamIo;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::Tag;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::info;
const INTERLEAVER_PATTERN: [usize; 48] = [
0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 1, 4, 7, 10, 13, 16, 19, 22, 25,
diff --git a/examples/wlan/src/mac.rs b/examples/wlan/src/mac.rs
index 3502bdbd..eb25f17a 100644
--- a/examples/wlan/src/mac.rs
+++ b/examples/wlan/src/mac.rs
@@ -3,7 +3,6 @@ use crate::MAX_PAYLOAD_SIZE;
use crate::MAX_PSDU_SIZE;
use futuresdr::anyhow::Result;
-use futuresdr::log::{debug, warn};
use futuresdr::macros::async_trait;
use futuresdr::macros::message_handler;
use futuresdr::runtime::Block;
@@ -15,6 +14,7 @@ use futuresdr::runtime::MessageIoBuilder;
use futuresdr::runtime::Pmt;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::{debug, warn};
pub struct Mac {
current_frame: [u8; MAX_PSDU_SIZE],
diff --git a/examples/wlan/src/viterbi_decoder.rs b/examples/wlan/src/viterbi_decoder.rs
index 5e416f75..57fe21cb 100644
--- a/examples/wlan/src/viterbi_decoder.rs
+++ b/examples/wlan/src/viterbi_decoder.rs
@@ -1,4 +1,4 @@
-// use futuresdr::log::info;
+// use futuresdr::tracing::info;
use crate::FrameParam;
use crate::Mcs;
diff --git a/examples/wlan/src/wasm/frontend.rs b/examples/wlan/src/wasm/frontend.rs
index f0d85dee..42df43d7 100644
--- a/examples/wlan/src/wasm/frontend.rs
+++ b/examples/wlan/src/wasm/frontend.rs
@@ -197,7 +197,6 @@ pub fn Gui() -> impl IntoView {
}
pub fn frontend() {
- _ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| view! { })
}
diff --git a/examples/zigbee/Cargo.toml b/examples/zigbee/Cargo.toml
index e1ac5af0..3b3499fa 100644
--- a/examples/zigbee/Cargo.toml
+++ b/examples/zigbee/Cargo.toml
@@ -22,7 +22,6 @@ futuresdr = { path = "../..", features = ["seify"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
-console_log = "1"
futuresdr = { path = "../.." }
gloo-worker = "0.5"
js-sys = "0.3"
diff --git a/examples/zigbee/src/frontend.rs b/examples/zigbee/src/frontend.rs
index 961b7031..e5efecf6 100644
--- a/examples/zigbee/src/frontend.rs
+++ b/examples/zigbee/src/frontend.rs
@@ -204,7 +204,6 @@ pub fn Gui() -> impl IntoView {
}
pub fn main() {
- _ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| view! { })
}
diff --git a/examples/zigbee/src/mac.rs b/examples/zigbee/src/mac.rs
index 529063f7..dac79449 100644
--- a/examples/zigbee/src/mac.rs
+++ b/examples/zigbee/src/mac.rs
@@ -1,7 +1,6 @@
use std::collections::VecDeque;
use futuresdr::anyhow::Result;
-use futuresdr::log::{debug, info, warn};
use futuresdr::macros::async_trait;
use futuresdr::macros::message_handler;
use futuresdr::runtime::Block;
@@ -15,6 +14,7 @@ use futuresdr::runtime::StreamIo;
use futuresdr::runtime::StreamIoBuilder;
use futuresdr::runtime::Tag;
use futuresdr::runtime::WorkIo;
+use futuresdr::tracing::{debug, info, warn};
const MAX_FRAMES: usize = 128;
const MAX_FRAME_SIZE: usize = 127;
diff --git a/examples/zigbee/src/wasm_gui.rs b/examples/zigbee/src/wasm_gui.rs
index a77c2125..7be805c9 100644
--- a/examples/zigbee/src/wasm_gui.rs
+++ b/examples/zigbee/src/wasm_gui.rs
@@ -1,4 +1,4 @@
-use futuresdr::log::info;
+use futuresdr::tracing::info;
use gloo_worker::Spawnable;
use gloo_worker::WorkerBridge;
use leptos::html::Select;
@@ -10,7 +10,6 @@ use crate::wasm_worker::Worker;
use crate::wasm_worker::WorkerMessage;
pub fn wasm_main() {
- _ = console_log::init_with_level(futuresdr::log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| view! { })
}
diff --git a/perf/buffer_rand/Cargo.toml b/perf/buffer_rand/Cargo.toml
index d95801b2..f2d8d954 100644
--- a/perf/buffer_rand/Cargo.toml
+++ b/perf/buffer_rand/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../..", features = ["flow_scheduler"] }
-log = { version = "0.4", features = ["release_max_level_off"] }
+tracing = { version = "0.1", features = ["release_max_level_off"] }
[[bin]]
name = "buffer_rand"
diff --git a/perf/buffer_size/Cargo.toml b/perf/buffer_size/Cargo.toml
index 72b0b239..d0d10d2d 100644
--- a/perf/buffer_size/Cargo.toml
+++ b/perf/buffer_size/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../..", features = ["flow_scheduler"] }
-log = { version = "0.4", features = ["release_max_level_off"] }
+tracing = { version = "0.1", features = ["release_max_level_off"] }
[[bin]]
name = "buffer_size"
diff --git a/perf/fir/Cargo.toml b/perf/fir/Cargo.toml
index 1abe9d73..b7f5b97e 100644
--- a/perf/fir/Cargo.toml
+++ b/perf/fir/Cargo.toml
@@ -8,8 +8,8 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../..", features = ["flow_scheduler", "tpb_scheduler"] }
-log = { version = "0.4", features = ["release_max_level_off"] }
rand = "0.8"
+tracing = { version = "0.1", features = ["release_max_level_off"] }
[[bin]]
name = "fir"
diff --git a/perf/fir_latency/Cargo.toml b/perf/fir_latency/Cargo.toml
index 5bc5a9f0..f75f1503 100644
--- a/perf/fir_latency/Cargo.toml
+++ b/perf/fir_latency/Cargo.toml
@@ -8,8 +8,8 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../..", features = ["flow_scheduler", "tpb_scheduler", "lttng"] }
-log = { version = "0.4", features = ["release_max_level_off"] }
rand = "0.8"
+tracing = { version = "0.1", features = ["release_max_level_off"] }
[[bin]]
name = "fir"
diff --git a/perf/msg/Cargo.toml b/perf/msg/Cargo.toml
index ebab58d1..fee5847b 100644
--- a/perf/msg/Cargo.toml
+++ b/perf/msg/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../.." }
-log = { version = "0.4", features = ["release_max_level_off"] }
+tracing = { version = "0.1", features = ["release_max_level_off"] }
[[bin]]
name = "msg"
diff --git a/perf/null_rand/Cargo.toml b/perf/null_rand/Cargo.toml
index 55188ce1..e9e7fd2f 100644
--- a/perf/null_rand/Cargo.toml
+++ b/perf/null_rand/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../..", features = ["flow_scheduler", "tpb_scheduler"] }
-log = { version = "0.4", features = ["release_max_level_off"] }
+tracing = { version = "0.1", features = ["release_max_level_off"] }
[[bin]]
name = "null_rand"
diff --git a/perf/null_rand_latency/Cargo.toml b/perf/null_rand_latency/Cargo.toml
index 30af63bb..ad0fc281 100644
--- a/perf/null_rand_latency/Cargo.toml
+++ b/perf/null_rand_latency/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../..", features = ["flow_scheduler", "tpb_scheduler", "lttng"] }
-log = { version = "0.4", features = ["release_max_level_off"] }
+tracing = { version = "0.1", features = ["release_max_level_off"] }
[[bin]]
name = "null_rand_latency"
diff --git a/perf/vulkan/Cargo.toml b/perf/vulkan/Cargo.toml
index 3f538587..2447a64e 100644
--- a/perf/vulkan/Cargo.toml
+++ b/perf/vulkan/Cargo.toml
@@ -8,8 +8,8 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../..", features = ["vulkan"] }
-log = { version = "0.4", features = ["release_max_level_off"] }
rand = "0.8"
+tracing = { version = "0.1", features = ["release_max_level_off"] }
[[bin]]
name = "vulkan"
diff --git a/perf/wgpu/Cargo.toml b/perf/wgpu/Cargo.toml
index 2c5aeb8c..42e1de83 100644
--- a/perf/wgpu/Cargo.toml
+++ b/perf/wgpu/Cargo.toml
@@ -10,13 +10,12 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
futuresdr = { path = "../..", features = ["wgpu"] }
-log = { version = "0.4", features = ["release_max_level_off"] }
rand = "0.8"
+tracing = { version = "0.1", features = ["release_max_level_off"] }
web-time = { version = "1.1" }
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
-console_log = "1"
leptos = { version = "0.6", features = ["csr", "nightly"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
diff --git a/perf/wgpu/src/bin/perf.rs b/perf/wgpu/src/bin/perf.rs
index 505779fd..9fff71e9 100644
--- a/perf/wgpu/src/bin/perf.rs
+++ b/perf/wgpu/src/bin/perf.rs
@@ -52,7 +52,6 @@ mod foo {
}
pub fn main() -> Result<()> {
- _ = console_log::init_with_level(futuresdr::log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| view! { });
Ok(())
diff --git a/perf/zynq/Cargo.toml b/perf/zynq/Cargo.toml
index aa2f3583..63716018 100644
--- a/perf/zynq/Cargo.toml
+++ b/perf/zynq/Cargo.toml
@@ -8,8 +8,8 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
futuresdr = { path = "../..", features = ["zynq"] }
-log = { version = "0.4", features = ["release_max_level_off"] }
rand = "0.8"
+tracing = { version = "0.1", features = ["release_max_level_off"] }
[[bin]]
name = "zynq"
diff --git a/src/lib.rs b/src/lib.rs
index 981e2ae5..9d1f1bc9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -49,7 +49,7 @@ pub use futures;
pub use futures_lite;
/// Logging macro
#[macro_use]
-pub extern crate log;
+pub extern crate tracing;
#[macro_use]
extern crate futuresdr_macros;
diff --git a/src/runtime/buffer/wgpu/d2h.rs b/src/runtime/buffer/wgpu/d2h.rs
index 4e428ee8..433c1afc 100644
--- a/src/runtime/buffer/wgpu/d2h.rs
+++ b/src/runtime/buffer/wgpu/d2h.rs
@@ -222,10 +222,9 @@ impl BufferReaderHost for ReaderD2H {
let buffer = self.buffer.as_mut().unwrap();
let capacity = buffer.slice.len() / self.item_size;
- log::info!(
+ info!(
"Consume -- capacity: {}, offset: {}",
- capacity,
- buffer.offset
+ capacity, buffer.offset
);
debug_assert!(amount + buffer.offset <= capacity);
diff --git a/src/runtime/config.rs b/src/runtime/config.rs
index 14ad3d5b..4342ebf3 100644
--- a/src/runtime/config.rs
+++ b/src/runtime/config.rs
@@ -2,13 +2,13 @@
use config::Value;
#[cfg(not(target_arch = "wasm32"))]
use config::{File, Source};
-use log::LevelFilter;
use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::net::SocketAddr;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Mutex;
+use tracing::level_filters::LevelFilter;
/// Get global configuration
pub fn config() -> Config {
@@ -182,7 +182,7 @@ impl Default for Config {
buffer_size: 32768,
stack_size: 16 * 1024 * 1024,
slab_reserved: 128,
- log_level: LevelFilter::Debug,
+ log_level: LevelFilter::DEBUG,
ctrlport_enable: true,
ctrlport_bind: "127.0.0.1:1337".parse::().ok(),
frontend_path: None,
@@ -197,7 +197,7 @@ impl Default for Config {
buffer_size: 32768,
stack_size: 16 * 1024 * 1024,
slab_reserved: 0,
- log_level: LevelFilter::Info,
+ log_level: LevelFilter::INFO,
ctrlport_enable: true,
ctrlport_bind: "127.0.0.1:1337".parse::().ok(),
frontend_path: None,
diff --git a/src/runtime/logging.rs b/src/runtime/logging.rs
index e128c5fb..0c250dd4 100644
--- a/src/runtime/logging.rs
+++ b/src/runtime/logging.rs
@@ -1,25 +1,23 @@
-use log::{Metadata, Record};
+use tracing_subscriber::filter::EnvFilter;
+use tracing_subscriber::fmt;
+use tracing_subscriber::prelude::*;
use crate::runtime::config;
-struct Logger;
-
-impl log::Log for Logger {
- fn enabled(&self, _metadata: &Metadata) -> bool {
- true
- }
+pub fn init() {
+ let format = fmt::layer()
+ .with_level(true)
+ .with_target(true)
+ .with_thread_ids(false)
+ .with_thread_names(true)
+ .compact();
- fn log(&self, record: &Record) {
- println!("FutureSDR: {} - {}", record.level(), record.args());
- }
+ let level = config::config().log_level;
+ let filter = EnvFilter::from_env("FUTURESDR_LOG").add_directive(level.into());
- fn flush(&self) {}
-}
+ let subscriber = tracing_subscriber::registry().with(filter).with(format);
-pub fn init() {
- if log::set_boxed_logger(Box::new(Logger)).is_err() {
+ if tracing::subscriber::set_global_default(subscriber).is_err() {
debug!("logger already initialized");
- } else {
- log::set_max_level(config::config().log_level);
}
}
diff --git a/src/runtime/logging_wasm.rs b/src/runtime/logging_wasm.rs
index 2d5c6386..d6ee4405 100644
--- a/src/runtime/logging_wasm.rs
+++ b/src/runtime/logging_wasm.rs
@@ -1,7 +1,3 @@
-use log::Level;
-
pub fn init() {
- if console_log::init_with_level(Level::Info).is_err() {
- debug!("logger already initialized");
- }
+ tracing_wasm::set_as_global_default();
}
diff --git a/src/runtime/scheduler/smol.rs b/src/runtime/scheduler/smol.rs
index 55d1052d..cf990b49 100644
--- a/src/runtime/scheduler/smol.rs
+++ b/src/runtime/scheduler/smol.rs
@@ -2,7 +2,6 @@ use async_executor::{Executor, Task};
use futures::channel::mpsc::{channel, Sender};
use futures::channel::oneshot;
use futures::future::Future;
-use log::debug;
use once_cell::sync::Lazy;
use slab::Slab;
use std::fmt;
diff --git a/tests/bad_block.rs b/tests/bad_block.rs
index f0b2a6be..b0910d1e 100644
--- a/tests/bad_block.rs
+++ b/tests/bad_block.rs
@@ -1,13 +1,13 @@
use futuresdr::anyhow::{bail, Result};
use futuresdr::async_io::block_on;
use futuresdr::blocks::{Head, NullSink, NullSource, Throttle};
-use futuresdr::log::debug;
use futuresdr::macros::async_trait;
use futuresdr::macros::connect;
use futuresdr::runtime::{
Block, BlockMeta, BlockMetaBuilder, Error, Flowgraph, Kernel, MessageIo, MessageIoBuilder,
Runtime, StreamIo, StreamIoBuilder, WorkIo,
};
+use futuresdr::tracing::debug;
use std::cmp;
use std::marker::PhantomData;