Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove zenoh_util from examples #1061

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ transport_unixpipe = ["zenoh/transport_unixpipe"]
[dependencies]
tokio = { workspace = true, features = ["rt-multi-thread", "time", "io-std"] }
clap = { workspace = true, features = ["derive"] }
zenoh-util = { workspace = true }
flume = { workspace = true }
futures = { workspace = true }
git-version = { workspace = true }
json5 = { workspace = true }
zenoh-collections = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
zenoh = { workspace = true, default-features = true }
zenoh-ext = { workspace = true }

Expand Down
10 changes: 8 additions & 2 deletions examples/examples/z_alloc_shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use zenoh::{

#[tokio::main]
async fn main() {
// Initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

run().await.unwrap()
}

Expand Down Expand Up @@ -144,3 +144,9 @@ async fn run() -> ZResult<()> {
// Publish SHM buffer
publisher.put(sbuf).await
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}
9 changes: 7 additions & 2 deletions examples/examples/z_delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ use zenoh_examples::CommonArgs;

#[tokio::main]
async fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (config, key_expr) = parse_args();

Expand All @@ -31,6 +30,12 @@ async fn main() {
session.close().await.unwrap();
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::Parser, Clone, PartialEq, Eq, Hash, Debug)]
struct Args {
#[arg(short, long, default_value = "demo/example/zenoh-rs-put")]
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ use zenoh_ext::SubscriberForward;

#[tokio::main]
async fn main() {
// Initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (config, key_expr, forward) = parse_args();

Expand All @@ -34,6 +33,12 @@ async fn main() {
subscriber.forward(publisher).await.unwrap();
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::Parser, Clone, PartialEq, Eq, Hash, Debug)]
struct Args {
#[arg(short, long, default_value = "demo/example/**")]
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use zenoh_examples::CommonArgs;

#[tokio::main]
async fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (config, selector, value, target, timeout) = parse_args();

Expand Down Expand Up @@ -63,6 +62,12 @@ async fn main() {
}
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::ValueEnum, Clone, Copy, Debug)]
#[value(rename_all = "SCREAMING_SNAKE_CASE")]
enum Qt {
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_get_liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use zenoh_examples::CommonArgs;

#[tokio::main]
async fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (config, key_expr, timeout) = parse_args();

Expand Down Expand Up @@ -48,6 +47,12 @@ async fn main() {
}
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(Parser, Clone, Debug)]
struct Args {
#[arg(short, long, default_value = "group1/**")]
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_get_shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ const N: usize = 10;

#[tokio::main]
async fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (mut config, selector, mut value, target, timeout) = parse_args();

Expand Down Expand Up @@ -101,6 +100,12 @@ async fn main() {
}
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::ValueEnum, Clone, Copy, Debug)]
#[value(rename_all = "SCREAMING_SNAKE_CASE")]
enum Qt {
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ use zenoh_examples::CommonArgs;

#[tokio::main]
async fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let config = parse_args();

Expand All @@ -37,6 +36,12 @@ async fn main() {
);
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::Parser, Clone, PartialEq, Eq, Hash, Debug)]
struct Args {
#[command(flatten)]
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ use zenoh_examples::CommonArgs;

#[tokio::main]
async fn main() {
// Initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (config, key_expr) = parse_args();

Expand All @@ -38,6 +37,12 @@ async fn main() {
};
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::Parser, Clone, PartialEq, Eq, Hash, Debug)]
struct Args {
#[arg(short, long, default_value = "group1/zenoh-rs")]
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ use zenoh::{bytes::ZBytes, key_expr::keyexpr, prelude::*, publisher::CongestionC
use zenoh_examples::CommonArgs;

fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (config, warmup, size, n, express) = parse_args();
let session = zenoh::open(config).wait().unwrap();
Expand Down Expand Up @@ -76,6 +75,12 @@ fn main() {
}
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(Parser)]
struct Args {
/// express for sending data
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_ping_shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ use zenoh::{
use zenoh_examples::CommonArgs;

fn main() {
// Initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (mut config, warmup, size, n) = parse_args();

Expand Down Expand Up @@ -102,6 +101,12 @@ fn main() {
}
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(Parser)]
struct Args {
#[arg(short, long, default_value = "1")]
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ use zenoh::{key_expr::keyexpr, prelude::*, publisher::CongestionControl, Config}
use zenoh_examples::CommonArgs;

fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (mut config, express) = parse_args();

Expand Down Expand Up @@ -49,6 +48,12 @@ fn main() {
std::thread::park();
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::Parser, Clone, PartialEq, Eq, Hash, Debug)]
struct Args {
/// express for sending data
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_pub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use zenoh_examples::CommonArgs;

#[tokio::main]
async fn main() {
// Initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (config, key_expr, value, attachment) = parse_args();

Expand All @@ -39,6 +38,12 @@ async fn main() {
}
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::Parser, Clone, PartialEq, Eq, Hash, Debug)]
struct Args {
#[arg(short, long, default_value = "demo/example/zenoh-rs-pub")]
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_pub_shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ const N: usize = 10;

#[tokio::main]
async fn main() -> Result<(), ZError> {
// Initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (mut config, path, value) = parse_args();

Expand Down Expand Up @@ -92,6 +91,12 @@ async fn main() -> Result<(), ZError> {
Ok(())
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::Parser, Clone, PartialEq, Eq, Hash, Debug)]
struct Args {
#[arg(short, long, default_value = "demo/example/zenoh-rs-pub")]
Expand Down
10 changes: 8 additions & 2 deletions examples/examples/z_pub_shm_thr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use zenoh_examples::CommonArgs;

#[tokio::main]
async fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (mut config, sm_size, size) = parse_args();

// A probing procedure for shared memory is performed upon session opening. To enable `z_pub_shm_thr` to operate
Expand Down Expand Up @@ -71,6 +71,12 @@ async fn main() {
}
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::Parser, Clone, PartialEq, Eq, Hash, Debug)]
struct Args {
#[arg(short, long, default_value = "32")]
Expand Down
10 changes: 8 additions & 2 deletions examples/examples/z_pub_thr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use zenoh::{
use zenoh_examples::CommonArgs;

fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let args = Args::parse();

let mut prio = Priority::DEFAULT;
Expand Down Expand Up @@ -68,6 +68,12 @@ fn main() {
}
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(Parser, Clone, PartialEq, Eq, Hash, Debug)]
struct Args {
/// express for sending data
Expand Down
9 changes: 7 additions & 2 deletions examples/examples/z_pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use zenoh_examples::CommonArgs;

#[tokio::main]
async fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();
initialize_logging();

let (config, key_expr, size, interval) = parse_args();

Expand Down Expand Up @@ -91,6 +90,12 @@ async fn main() {
// }
}

fn initialize_logging() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init()
}

#[derive(clap::Parser, Clone, PartialEq, Debug)]
struct SubArgs {
#[arg(short, long, default_value = "demo/example/**")]
Expand Down
Loading