diff --git a/crates/llama_cpp/Cargo.toml b/crates/llama_cpp/Cargo.toml index 2e1cc7c..df4b698 100644 --- a/crates/llama_cpp/Cargo.toml +++ b/crates/llama_cpp/Cargo.toml @@ -40,6 +40,7 @@ blas = ["llama_cpp_sys/blas"] hipblas = ["llama_cpp_sys/hipblas"] clblast = ["llama_cpp_sys/clblast"] vulkan = ["llama_cpp_sys/vulkan"] +sys_verbosity = [] # increase sys crate tracing log verbosity level [lib] doctest = false diff --git a/crates/llama_cpp/src/detail.rs b/crates/llama_cpp/src/detail.rs index afec13a..6d5837a 100644 --- a/crates/llama_cpp/src/detail.rs +++ b/crates/llama_cpp/src/detail.rs @@ -6,7 +6,11 @@ use std::ffi::{c_char, c_void, CStr}; -use tracing::{debug, error, info, warn}; +#[cfg(not(feature = "sys_verbosity"))] +use tracing::info; +#[cfg(feature = "sys_verbosity")] +use tracing::trace; +use tracing::{debug, error, warn}; use llama_cpp_sys::ggml_log_level; @@ -34,8 +38,14 @@ pub(crate) unsafe extern "C" fn llama_log_callback( }; match level { - ggml_log_level::GGML_LOG_LEVEL_INFO => info!(target: "llama.cpp", "{text}"), + #[cfg(feature = "sys_verbosity")] + ggml_log_level::GGML_LOG_LEVEL_DEBUG => trace!(target: "llama.cpp", "{text}"), + #[cfg(feature = "sys_verbosity")] + ggml_log_level::GGML_LOG_LEVEL_INFO => debug!(target: "llama.cpp", "{text}"), + #[cfg(not(feature = "sys_verbosity"))] ggml_log_level::GGML_LOG_LEVEL_DEBUG => debug!(target: "llama.cpp", "{text}"), + #[cfg(not(feature = "sys_verbosity"))] + ggml_log_level::GGML_LOG_LEVEL_INFO => info!(target: "llama.cpp", "{text}"), ggml_log_level::GGML_LOG_LEVEL_WARN => warn!(target: "llama.cpp", "{text}"), ggml_log_level::GGML_LOG_LEVEL_ERROR => error!(target: "llama.cpp", "{text}"), _ => unimplemented!(),