pub struct Config<TMsg> {
pub level: Level,
pub fn_input: fn(_: Message<TMsg>) -> Result<Option<String>>,
}
Expand description
Настройки компонента логгирования
Fields§
§level: Level
Уровень логгирования
fn_input: fn(_: Message<TMsg>) -> Result<Option<String>>
Функция преобразования входящих сообщений в записи.
Можно реализовать фильтрацию сообщений.
Примеры
- Логгирование всех сообщений
fn_input: |msg| Ok(Some(msg.serialize()?)),
- Логгирование всех сообщений с заголовком
fn_input: |msg| {
let text = msg.serialize()?;
let text = format!("Header: {text}");
Ok(Some(text))
},
Trait Implementations§
Source§impl<TMsg, TService> IComponentProcess<Config<TMsg>, TMsg, TService> for Component<Config<TMsg>, TMsg, TService>where
TMsg: MsgDataBound,
TService: ServiceBound,
impl<TMsg, TService> IComponentProcess<Config<TMsg>, TMsg, TService> for Component<Config<TMsg>, TMsg, TService>where
TMsg: MsgDataBound,
TService: ServiceBound,
Auto Trait Implementations§
impl<TMsg> Freeze for Config<TMsg>
impl<TMsg> RefUnwindSafe for Config<TMsg>
impl<TMsg> Send for Config<TMsg>
impl<TMsg> Sync for Config<TMsg>
impl<TMsg> Unpin for Config<TMsg>
impl<TMsg> UnwindSafe for Config<TMsg>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more