Skip to content

Commit

Permalink
Merge pull request #1459 from microsoft/enhancement-log-full
Browse files Browse the repository at this point in the history
[logging] Enhancement: Turn on more log details
  • Loading branch information
anandbonde authored Nov 14, 2024
2 parents 9639ebb + da925b6 commit 5017253
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/rust/runtime/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Imports
//======================================================================================================================

use ::flexi_logger::Logger;
use ::flexi_logger::{with_thread, Logger};
use ::std::sync::Once;

//======================================================================================================================
Expand All @@ -22,6 +22,6 @@ static INIT_LOG: Once = Once::new();
/// Initializes logging features.
pub fn initialize() {
INIT_LOG.call_once(|| {
Logger::try_with_env().unwrap().start().unwrap();
Logger::try_with_env().unwrap().format(with_thread).start().unwrap();
});
}
56 changes: 28 additions & 28 deletions tests/rust/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ mod test {
let bob_barrier: Arc<Barrier> = Arc::new(Barrier::new(2));
let alice_barrier: Arc<Barrier> = bob_barrier.clone();

let alice: JoinHandle<Result<()>> = thread::spawn(move || {
let alice: JoinHandle<Result<()>> = thread::Builder::new().name(format!("alice")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, alice_tx, bob_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -128,9 +128,9 @@ mod test {
alice_barrier.wait();

Ok(())
});
})?;

let bob: JoinHandle<Result<()>> = thread::spawn(move || {
let bob: JoinHandle<Result<()>> = thread::Builder::new().name(format!("bob")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(BOB_CONFIG_PATH, bob_tx, alice_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand All @@ -157,7 +157,7 @@ mod test {
bob_barrier.wait();

Ok(())
});
})?;

// It is safe to use unwrap here because there should not be any reason that we can't join the thread and if there
// is, there is nothing to clean up here on the main thread.
Expand All @@ -176,7 +176,7 @@ mod test {
let bob_barrier: Arc<Barrier> = Arc::new(Barrier::new(2));
let alice_barrier: Arc<Barrier> = bob_barrier.clone();

let alice: JoinHandle<Result<()>> = thread::spawn(move || {
let alice: JoinHandle<Result<()>> = thread::Builder::new().name(format!("alice")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, alice_tx, bob_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -207,9 +207,9 @@ mod test {
alice_barrier.wait();

Ok(())
});
})?;

let bob: JoinHandle<Result<()>> = thread::spawn(move || {
let bob: JoinHandle<Result<()>> = thread::Builder::new().name(format!("bob")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(BOB_CONFIG_PATH, bob_tx, alice_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -237,7 +237,7 @@ mod test {
// Sleep for a while to give Alice time to finish.
bob_barrier.wait();
Ok(())
});
})?;

// It is safe to use unwrap here because there should not be any reason that we can't join the thread and if there
// is, there is nothing to clean up here on the main thread.
Expand All @@ -260,7 +260,7 @@ mod test {
let bob_barrier: Arc<Barrier> = Arc::new(Barrier::new(2));
let alice_barrier: Arc<Barrier> = bob_barrier.clone();

let alice: JoinHandle<Result<()>> = thread::spawn(move || {
let alice: JoinHandle<Result<()>> = thread::Builder::new().name(format!("alice")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, alice_tx, bob_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -300,9 +300,9 @@ mod test {
safe_close_passive(&mut libos, sockqd)?;
alice_barrier.wait();
Ok(())
});
})?;

let bob: JoinHandle<Result<()>> = thread::spawn(move || {
let bob: JoinHandle<Result<()>> = thread::Builder::new().name(format!("bob")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(BOB_CONFIG_PATH, bob_tx, alice_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -340,7 +340,7 @@ mod test {
bob_barrier.wait();

Ok(())
});
})?;
// It is safe to use unwrap here because there should not be any reason that we can't join the thread and if there
// is, there is nothing to clean up here on the main thread.
alice.join().unwrap()?;
Expand Down Expand Up @@ -616,7 +616,7 @@ mod test {
let bob_barrier: Arc<Barrier> = Arc::new(Barrier::new(2));
let alice_barrier: Arc<Barrier> = bob_barrier.clone();

let alice: JoinHandle<Result<()>> = thread::spawn(move || {
let alice: JoinHandle<Result<()>> = thread::Builder::new().name(format!("alice")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, alice_tx, bob_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand All @@ -643,9 +643,9 @@ mod test {
safe_close_passive(&mut libos, sockqd)?;
alice_barrier.wait();
Ok(())
});
})?;

let bob: JoinHandle<Result<()>> = thread::spawn(move || {
let bob: JoinHandle<Result<()>> = thread::Builder::new().name(format!("bob")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(BOB_CONFIG_PATH, bob_tx, alice_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -695,7 +695,7 @@ mod test {
safe_close_active(&mut libos, sockqd)?;
bob_barrier.wait();
Ok(())
});
})?;

// It is safe to use unwrap here because there should not be any reason that we can't join the thread and if there
// is, there is nothing to clean up here on the main thread.
Expand All @@ -718,7 +718,7 @@ mod test {
let bob_barrier: Arc<Barrier> = Arc::new(Barrier::new(2));
let alice_barrier: Arc<Barrier> = bob_barrier.clone();

let alice: JoinHandle<Result<()>> = thread::spawn(move || {
let alice: JoinHandle<Result<()>> = thread::Builder::new().name(format!("alice")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, alice_tx, bob_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -759,9 +759,9 @@ mod test {

alice_barrier.wait();
Ok(())
});
})?;

let bob: JoinHandle<Result<()>> = thread::spawn(move || {
let bob: JoinHandle<Result<()>> = thread::Builder::new().name(format!("bob")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(BOB_CONFIG_PATH, bob_tx, alice_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -801,7 +801,7 @@ mod test {

bob_barrier.wait();
Ok(())
});
})?;

// It is safe to use unwrap here because there should not be any reason that we can't join the thread and if there
// is, there is nothing to clean up here on the main thread.
Expand All @@ -824,7 +824,7 @@ mod test {
let bob_barrier: Arc<Barrier> = Arc::new(Barrier::new(2));
let alice_barrier: Arc<Barrier> = bob_barrier.clone();

let alice: JoinHandle<Result<()>> = thread::spawn(move || {
let alice: JoinHandle<Result<()>> = thread::Builder::new().name(format!("alice")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, alice_tx, bob_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -865,9 +865,9 @@ mod test {
alice_barrier.wait();

Ok(())
});
})?;

let bob: JoinHandle<Result<()>> = thread::spawn(move || {
let bob: JoinHandle<Result<()>> = thread::Builder::new().name(format!("bob")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(BOB_CONFIG_PATH, bob_tx, alice_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -933,7 +933,7 @@ mod test {

bob_barrier.wait();
Ok(())
});
})?;

// It is safe to use unwrap here because there should not be any reason that we can't join the thread and if there
// is, there is nothing to clean up here on the main thread.
Expand All @@ -956,7 +956,7 @@ mod test {
let bob_barrier: Arc<Barrier> = Arc::new(Barrier::new(2));
let alice_barrier: Arc<Barrier> = bob_barrier.clone();

let alice: JoinHandle<Result<()>> = thread::spawn(move || {
let alice: JoinHandle<Result<()>> = thread::Builder::new().name(format!("alice")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, alice_tx, bob_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -1007,9 +1007,9 @@ mod test {

alice_barrier.wait();
Ok(())
});
})?;

let bob: JoinHandle<Result<()>> = thread::spawn(move || {
let bob: JoinHandle<Result<()>> = thread::Builder::new().name(format!("bob")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(BOB_CONFIG_PATH, bob_tx, alice_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -1047,7 +1047,7 @@ mod test {

bob_barrier.wait();
Ok(())
});
})?;

// It is safe to use unwrap here because there should not be any reason that we can't join the thread and if there
// is, there is nothing to clean up here on the main thread.
Expand Down
16 changes: 8 additions & 8 deletions tests/rust/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ mod test {
let bob_barrier: Arc<Barrier> = Arc::new(Barrier::new(2));
let alice_barrier: Arc<Barrier> = bob_barrier.clone();

let alice: JoinHandle<Result<()>> = thread::spawn(move || {
let alice: JoinHandle<Result<()>> = thread::Builder::new().name(format!("alice")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, alice_tx, bob_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -243,9 +243,9 @@ mod test {
},
Err(e) => anyhow::bail!("close() failed: {:?}", e),
}
});
})?;

let bob: JoinHandle<Result<()>> = thread::spawn(move || {
let bob: JoinHandle<Result<()>> = thread::Builder::new().name(format!("bob")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(BOB_CONFIG_PATH, bob_tx, alice_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -313,7 +313,7 @@ mod test {
},
Err(e) => anyhow::bail!("close() failed: {:?}", e),
}
});
})?;

// It is safe to use unwrap here because there should not be any reason that we can't join the thread and if there
// is, there is nothing to clean up here on the main thread.
Expand All @@ -335,7 +335,7 @@ mod test {
let bob_barrier: Arc<Barrier> = Arc::new(Barrier::new(2));
let alice_barrier: Arc<Barrier> = bob_barrier.clone();

let alice: JoinHandle<Result<()>> = thread::spawn(move || {
let alice: JoinHandle<Result<()>> = thread::Builder::new().name(format!("alice")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, alice_tx, bob_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -402,9 +402,9 @@ mod test {
},
Err(e) => anyhow::bail!("close() failed: {:?}", e),
}
});
})?;

let bob = thread::spawn(move || {
let bob = thread::Builder::new().name(format!("bob")).spawn(move || {
let mut libos: DummyLibOS = match DummyLibOS::new_test(ALICE_CONFIG_PATH, bob_tx, alice_rx) {
Ok(libos) => libos,
Err(e) => anyhow::bail!("Could not create inetstack: {:?}", e),
Expand Down Expand Up @@ -464,7 +464,7 @@ mod test {
},
Err(e) => anyhow::bail!("close() failed: {:?}", e),
}
});
})?;

// It is safe to use unwrap here because there should not be any reason that we can't join the thread and if there
// is, there is nothing to clean up here on the main thread.
Expand Down

0 comments on commit 5017253

Please sign in to comment.