MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / init_file_per_thread_logger

Function init_file_per_thread_logger

crates/cli-flags/src/lib.rs:17–43  ·  view source on GitHub ↗
(prefix: &'static str)

Source from the content-addressed store, hash-verified

15
16#[cfg(feature = "logging")]
17fn init_file_per_thread_logger(prefix: &'static str) {
18 file_per_thread_logger::initialize(prefix);
19 file_per_thread_logger::allow_uninitialized();
20
21 // Extending behavior of default spawner:
22 // https://docs.rs/rayon/1.1.0/rayon/struct.ThreadPoolBuilder.html#method.spawn_handler
23 // Source code says DefaultSpawner is implementation detail and
24 // shouldn't be used directly.
25 #[cfg(feature = "parallel-compilation")]
26 rayon::ThreadPoolBuilder::new()
27 .spawn_handler(move |thread| {
28 let mut b = std::thread::Builder::new();
29 if let Some(name) = thread.name() {
30 b = b.name(name.to_owned());
31 }
32 if let Some(stack_size) = thread.stack_size() {
33 b = b.stack_size(stack_size);
34 }
35 b.spawn(move || {
36 file_per_thread_logger::initialize(prefix);
37 thread.run()
38 })?;
39 Ok(())
40 })
41 .build_global()
42 .unwrap();
43}
44
45wasmtime_option_group! {
46 #[derive(PartialEq, Clone, Deserialize)]

Callers 1

init_loggingMethod · 0.85

Calls 8

OkFunction · 0.85
stack_sizeMethod · 0.80
initializeFunction · 0.50
newFunction · 0.50
unwrapMethod · 0.45
nameMethod · 0.45
spawnMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected