pub fn set_extra_fields(
extra_fields: impl Serialize,
) -> Result<(), SetExtraFieldsError>
Expand description
Configure extra fields added to the log record.
This function may be called multiple times, either before or after ecs_logger::init
.
All extra fields previously set by this function will be cleared.
ยงExample
use ecs_logger::extra_fields;
use serde::Serialize;
#[derive(Serialize)]
struct MyExtraFields {
my_field: String,
}
extra_fields::set_extra_fields(MyExtraFields {
my_field: "my_value".to_string(),
}).unwrap();