pub struct LogEvent {
pub runlevel: Runlevel,
pub message: String,
/* private fields */
}Expand description
Tor logging event for receiving log messages from the Tor process.
These are the most visible kind of event since, by default, Tor logs
at the NOTICE Runlevel to stdout. Log events allow controllers to
receive and process Tor’s log output programmatically.
§Runlevels
Log events are categorized by severity:
Runlevel::Debug- Verbose debugging informationRunlevel::Info- Informational messagesRunlevel::Notice- Normal operational messages (default)Runlevel::Warn- Warning conditionsRunlevel::Err- Error conditions
§Event Types
Each runlevel corresponds to a separate event type:
DEBUG,INFO,NOTICE,WARN,ERR
§Example
ⓘ
use stem_rs::{EventType, Runlevel};
use stem_rs::events::LogEvent;
fn handle_log(event: &LogEvent) {
match event.runlevel {
Runlevel::Err | Runlevel::Warn => {
eprintln!("[{}] {}", event.runlevel, event.message);
}
_ => {
println!("[{}] {}", event.runlevel, event.message);
}
}
}§See Also
Runlevel- Log severity levelsStatusEvent- Structured status messages
Fields§
§runlevel: RunlevelSeverity level of the log message.
message: StringThe log message content.
Implementations§
Trait Implementations§
Source§impl Event for LogEvent
impl Event for LogEvent
Source§fn event_type(&self) -> EventType
fn event_type(&self) -> EventType
Returns the type of this event. Read more
Source§fn raw_content(&self) -> &str
fn raw_content(&self) -> &str
Returns the raw, unparsed content of the event. Read more
Source§fn arrived_at(&self) -> Instant
fn arrived_at(&self) -> Instant
Returns the instant when this event was received. Read more
Auto Trait Implementations§
impl Freeze for LogEvent
impl RefUnwindSafe for LogEvent
impl Send for LogEvent
impl Sync for LogEvent
impl Unpin for LogEvent
impl UnwindSafe for LogEvent
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