diff --git a/Cargo.lock b/Cargo.lock index 30a379510f..b626972d2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3327,7 +3327,9 @@ dependencies = [ "cap-std", "env_logger 0.10.0", "futures", + "log", "once_cell", + "tracing", "wasi-cap-std-sync", "wasi-common", "wasmtime", diff --git a/crates/c-api/Cargo.toml b/crates/c-api/Cargo.toml index 3d359437e6..43980e8dc3 100644 --- a/crates/c-api/Cargo.toml +++ b/crates/c-api/Cargo.toml @@ -11,17 +11,19 @@ publish = false [lib] name = "wasmtime" -crate-type = ["staticlib", "cdylib", "rlib"] +crate-type = ["staticlib", "cdylib"] doc = false test = false doctest = false [dependencies] -env_logger = { workspace = true } +env_logger = { workspace = true, optional = true } anyhow = { workspace = true } once_cell = { workspace = true } wasmtime = { workspace = true, features = ['cranelift'] } wasmtime-c-api-macros = { path = "macros" } +log = { workspace = true } +tracing = { workspace = true } # Optional dependency for the `wat2wasm` API wat = { workspace = true, optional = true } @@ -36,9 +38,22 @@ wasi-common = { workspace = true, optional = true } futures = { workspace = true, optional = true } [features] -default = ['profiling', 'wat', 'wasi', 'cache', 'parallel-compilation', 'async'] +default = [ + 'profiling', + 'wat', + 'wasi', + 'cache', + 'parallel-compilation', + 'async', + 'coredump', + 'addr2line', +] async = ['wasmtime/async', 'futures'] profiling = ["wasmtime/profiling"] cache = ["wasmtime/cache"] parallel-compilation = ['wasmtime/parallel-compilation'] wasi = ['wasi-cap-std-sync', 'wasmtime-wasi', 'cap-std', 'wasi-common'] +logging = ['dep:env_logger'] +disable-logging = ["log/max_level_off", "tracing/max_level_off"] +coredump = ["wasmtime/coredump"] +addr2line = ["wasmtime/addr2line"] diff --git a/crates/c-api/src/engine.rs b/crates/c-api/src/engine.rs index 67785fc03f..06a2b1b3f4 100644 --- a/crates/c-api/src/engine.rs +++ b/crates/c-api/src/engine.rs @@ -19,6 +19,7 @@ pub extern "C" fn wasm_engine_new() -> Box { // Note that we `drop` the result here since this fails after the first // initialization attempt. We don't mind that though because this function // can be called multiple times, so we just ignore the result. + #[cfg(feature = "logging")] drop(env_logger::try_init()); Box::new(wasm_engine_t {