pub struct LogEvent {
pub timestamp_unix: u64,
pub sender: Option<Participant>,
pub receiver: Option<Participant>,
pub event_type: EventType,
pub channel: Channel,
pub payload: Payload,
}Expand description
Bundle of data emitted through the logging system.
Fields§
§timestamp_unix: u64UNIX timestamp in seconds when the event was created.
sender: Option<Participant>Optional sender of the event.
receiver: Option<Participant>Optional receiver of the event.
event_type: EventTypeHigh-level event category.
channel: ChannelLogging channel / severity level.
payload: PayloadArbitrary key–value payload.
Implementations§
Source§impl LogEvent
impl LogEvent
Sourcepub fn new(
sender: Option<Participant>,
receiver: Option<Participant>,
event_type: EventType,
channel: Channel,
payload: Payload,
) -> Self
pub fn new( sender: Option<Participant>, receiver: Option<Participant>, event_type: EventType, channel: Channel, payload: Payload, ) -> Self
Create an event with the current UNIX timestamp and optional participants.
The timestamp uses SystemTime::now().duration_since(UNIX_EPOCH) and
falls back to 0 if the clock is earlier than the Unix epoch. This
avoids panics on misconfigured systems while still producing a stable,
clearly out-of-band value.
Sourcepub fn broadcast(
sender: Participant,
event_type: EventType,
channel: Channel,
payload: Payload,
) -> Self
pub fn broadcast( sender: Participant, event_type: EventType, channel: Channel, payload: Payload, ) -> Self
Convenience: broadcast from a known sender to no specific receiver.
Sourcepub fn system(event_type: EventType, channel: Channel, payload: Payload) -> Self
pub fn system(event_type: EventType, channel: Channel, payload: Payload) -> Self
Convenience: emit an event without sender or receiver (e.g. system state).
Sourcepub fn self_directed(
actor: Participant,
event_type: EventType,
channel: Channel,
payload: Payload,
) -> Self
pub fn self_directed( actor: Participant, event_type: EventType, channel: Channel, payload: Payload, ) -> Self
Convenience: emit an event where sender and receiver are the same actor.
Sourcepub fn id_from_str(s: &str) -> u64
pub fn id_from_str(s: &str) -> u64
Generate a deterministic identifier from an arbitrary string.