pub struct QlogStreamer { /* private fields */ }
Implementations§
Source§impl QlogStreamer
impl QlogStreamer
Sourcepub fn new(
qlog_version: String,
title: Option<String>,
description: Option<String>,
summary: Option<String>,
start_time: Instant,
trace: TraceSeq,
log_level: EventImportance,
writer: Box<dyn Write + Send + Sync>,
) -> Self
pub fn new( qlog_version: String, title: Option<String>, description: Option<String>, summary: Option<String>, start_time: Instant, trace: TraceSeq, log_level: EventImportance, writer: Box<dyn Write + Send + Sync>, ) -> Self
Creates a QlogStreamer object.
It owns a QlogSeq object that contains the provided TraceSeq containing Events.
All serialization will be written to the provided Write
using the
JSON-SEQ format.
Sourcepub fn start_log(&mut self) -> Result<()>
pub fn start_log(&mut self) -> Result<()>
Starts qlog streaming serialization.
This writes out the JSON-SEQ-serialized form of all initial qlog information. Events are separately appended using add_event(), add_event_with_instant(), add_event_now(), add_event_data_with_instant(), or add_event_data_now().
Sourcepub fn finish_log(&mut self) -> Result<()>
pub fn finish_log(&mut self) -> Result<()>
Finishes qlog streaming serialization.
After this is called, no more serialization will occur.
Sourcepub fn add_event_now<E: Serialize + Eventable>(
&mut self,
event: E,
) -> Result<()>
pub fn add_event_now<E: Serialize + Eventable>( &mut self, event: E, ) -> Result<()>
Writes a serializable to a JSON-SEQ record using std::time::Instant::now().
Sourcepub fn add_event_with_instant<E: Serialize + Eventable>(
&mut self,
event: E,
now: Instant,
) -> Result<()>
pub fn add_event_with_instant<E: Serialize + Eventable>( &mut self, event: E, now: Instant, ) -> Result<()>
Writes a serializable to a JSON-SEQ record using the provided std::time::Instant.
Sourcepub fn add_event_data_now(&mut self, event_data: EventData) -> Result<()>
pub fn add_event_data_now(&mut self, event_data: EventData) -> Result<()>
Writes an Event based on the provided EventData to a JSON-SEQ record at time std::time::Instant::now().
Sourcepub fn add_event_data_ex_now(
&mut self,
event_data: EventData,
ex_data: ExData,
) -> Result<()>
pub fn add_event_data_ex_now( &mut self, event_data: EventData, ex_data: ExData, ) -> Result<()>
Writes an Event based on the provided EventData and ExData to a JSON-SEQ record at time std::time::Instant::now().
Sourcepub fn add_event_data_with_instant(
&mut self,
event_data: EventData,
now: Instant,
) -> Result<()>
pub fn add_event_data_with_instant( &mut self, event_data: EventData, now: Instant, ) -> Result<()>
Writes an Event based on the provided EventData and std::time::Instant to a JSON-SEQ record.
Sourcepub fn add_event_data_ex_with_instant(
&mut self,
event_data: EventData,
ex_data: ExData,
now: Instant,
) -> Result<()>
pub fn add_event_data_ex_with_instant( &mut self, event_data: EventData, ex_data: ExData, now: Instant, ) -> Result<()>
Writes an Event based on the provided EventData, ExData, and std::time::Instant to a JSON-SEQ record.