Log loaned msg error only once

This commit is contained in:
Marco 2023-04-20 18:18:25 +02:00 committed by Martin Dahl
parent 9f7b11da87
commit 8b93894fc5
1 changed files with 7 additions and 4 deletions

View File

@ -3,6 +3,7 @@ use std::ffi::CString;
use std::fmt::Debug;
use std::marker::PhantomData;
use std::sync::Weak;
use std::sync::Once;
use crate::error::*;
use crate::msg_types::*;
@ -206,10 +207,12 @@ where
);
Ok(msg)
} else {
static LOG_LOANED_ERROR: Once = Once::new();
LOG_LOANED_ERROR.call_once(|| {
// TODO: Switch to logging library
eprintln!(
"Currently used middleware can't loan messages. Local allocator will be used."
);
eprintln!("Currently used middleware can't loan messages. Local allocator will be used.");
});
Ok(WrappedNativeMsg::<T>::new())
}
}