Skip to content

Commit

Permalink
tracingのレベルでortのログを抑える
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Jan 23, 2024
1 parent 205274d commit d3b971e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 0 additions & 3 deletions crates/voicevox_core/src/infer/runtimes/onnxruntime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ impl InferenceRuntime for Onnxruntime {

fn build_ort_env_once() -> ort::Result<()> {
static ONCE: once_cell::sync::OnceCell<()> = once_cell::sync::OnceCell::new();

// FIXME: ログレベルを絞る

ONCE.get_or_try_init(|| ort::init().with_name(env!("CARGO_PKG_NAME")).commit())?;
Ok(())
}
Expand Down
9 changes: 8 additions & 1 deletion crates/voicevox_core_c_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ fn init_logger_once() {
.with_env_filter(if env::var_os(EnvFilter::DEFAULT_ENV).is_some() {
EnvFilter::from_default_env()
} else {
"error,voicevox_core=info,voicevox_core_c_api=info,ort=info".into()
pub const ORT_LOGGING_LEVEL: &str = if cfg!(debug_assertions) {
"info"
} else {
"warn"
};
EnvFilter::from(format!(
"error,voicevox_core=info,voicevox_core_c_api=info,ort={ORT_LOGGING_LEVEL}"
))
})
.with_timer(local_time as fn(&mut Writer<'_>) -> _)
.with_ansi(ansi)
Expand Down
2 changes: 2 additions & 0 deletions crates/voicevox_core_java_api/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern "system" fn Java_jp_hiroshiba_voicevoxcore_Dll_00024LoggerInitializer_ini
.with_tag("VoicevoxCore")
.with_filter(
android_logger::FilterBuilder::new()
// FIXME: ortも`warn`は出すべき
.parse("error,voicevox_core=info,voicevox_core_java_api=info,ort=error")
.build(),
),
Expand All @@ -36,6 +37,7 @@ extern "system" fn Java_jp_hiroshiba_voicevoxcore_Dll_00024LoggerInitializer_ini
.with_env_filter(if env::var_os(EnvFilter::DEFAULT_ENV).is_some() {
EnvFilter::from_default_env()
} else {
// FIXME: `c_api`じゃないし、ortも`warn`は出すべき
"error,voicevox_core=info,voicevox_core_c_api=info,ort=error".into()
})
.with_timer(local_time as fn(&mut Writer<'_>) -> _)
Expand Down

0 comments on commit d3b971e

Please sign in to comment.