Skip to content
Merged
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
38 changes: 13 additions & 25 deletions Cargo.lock

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

5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,3 @@ members = ["iroh-n0des-macro"]
[[bin]]
name = "iroh-n0des"
path = "src/main.rs"

[patch.crates-io]
iroh = { git = "https://github.com/n0-computer/iroh.git", branch = "main" }
irpc = { git = "https://github.com/n0-computer/irpc.git", branch = "main" }
irpc-iroh = { git = "https://github.com/n0-computer/irpc.git", branch = "main" }
4 changes: 2 additions & 2 deletions src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,10 @@ where
.with_context(|| format!("simulation builder function `{name}` failed"))?
.build(name)
.await
.with_context(|| format!("simulation `{name}` failed to build"))?
.with_context(|| format!("simulation `{name}` failed to start"))?
.run()
.await
.with_context(|| format!("simulation `{name}` failed to run"));
.with_context(|| format!("simulation `{name}` failed to complete"));

match &result {
Ok(()) => eprintln!("simulation `{name}` passed"),
Expand Down
4 changes: 4 additions & 0 deletions src/simulation/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ impl TraceClient {
}
}

pub fn new(client: irpc::Client<TraceProtocol>, session_id: Uuid) -> Self {
Self { client, session_id }
}

pub fn connect_quinn_insecure(remote: SocketAddr, session_id: Uuid) -> Result<Self> {
let addr_localhost = "127.0.0.1:0".parse().unwrap();
let endpoint = make_insecure_client_endpoint(addr_localhost)?;
Expand Down
10 changes: 9 additions & 1 deletion src/simulation/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
};

use tracing_subscriber::{
EnvFilter, Layer,
EnvFilter, Layer, Registry,
fmt::{MakeWriter, writer::MutexGuardWriter},
layer::SubscriberExt,
util::{SubscriberInitExt, TryInitError},
Expand All @@ -23,6 +23,14 @@ pub fn init() {
}
}

pub fn create_writer_and_layer() -> (impl Layer<Registry>, LineWriter) {
let writer = LineWriter::default();
let layer = tracing_subscriber::fmt::layer()
.json()
.with_writer(writer.clone());
(layer, writer)
}

pub fn try_init() -> Result<(), TryInitError> {
let print_layer = if let Ok(directive) = std::env::var(ENV_RUST_LOG) {
let layer = tracing_subscriber::fmt::layer()
Expand Down
Loading