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

Method init_logging

crates/cli-flags/src/lib.rs:773–804  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

771 }
772
773 pub fn init_logging(&mut self) -> Result<()> {
774 self.configure()?;
775 if self.debug.logging == Some(false) {
776 return Ok(());
777 }
778 #[cfg(feature = "logging")]
779 if self.debug.log_to_files == Some(true) {
780 let prefix = "wasmtime.dbg.";
781 init_file_per_thread_logger(prefix);
782 } else {
783 use std::io::IsTerminal;
784 use tracing_subscriber::{EnvFilter, FmtSubscriber};
785 let builder = FmtSubscriber::builder()
786 .with_writer(std::io::stderr)
787 .with_env_filter(EnvFilter::from_env("WASMTIME_LOG"))
788 .with_ansi(std::io::stderr().is_terminal());
789 if std::env::var("WASMTIME_LOG_NO_CONTEXT").is_ok_and(|value| value.eq("1")) {
790 builder
791 .with_level(false)
792 .with_target(false)
793 .without_time()
794 .init()
795 } else {
796 builder.init();
797 }
798 }
799 #[cfg(not(feature = "logging"))]
800 if self.debug.log_to_files == Some(true) || self.debug.logging == Some(true) {
801 bail!("support for logging disabled at compile time");
802 }
803 Ok(())
804 }
805
806 pub fn config(&mut self, pooling_allocator_default: Option<bool>) -> Result<Config> {
807 self.configure()?;

Callers 7

executeMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80

Calls 8

OkFunction · 0.85
builderFunction · 0.50
stderrFunction · 0.50
configureMethod · 0.45
is_terminalMethod · 0.45
eqMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected