pub struct ProofLogger { /* private fields */ }Expand description
Streams proof steps to a binary log file during solving.
§Examples
use std::path::Path;
use oxiz_proof::logging::ProofLogger;
use oxiz_proof::proof::{ProofStep, ProofNodeId};
let mut logger = ProofLogger::create(Path::new("/tmp/proof.oxizlog"))
.expect("failed to create log");
logger.log_step(ProofNodeId(0), &ProofStep::Axiom {
conclusion: "true".to_string(),
}).expect("failed to log step");
logger.close().expect("failed to close log");Implementations§
Source§impl ProofLogger
impl ProofLogger
Sourcepub fn create(path: &Path) -> LoggingResult<Self>
pub fn create(path: &Path) -> LoggingResult<Self>
Create a new proof log at path, overwriting any existing file.
Writes the file header immediately.
Sourcepub fn append(path: &Path) -> LoggingResult<Self>
pub fn append(path: &Path) -> LoggingResult<Self>
Open an existing proof log for appending.
Does not write a new header; the file must already have a valid header
written by a previous ProofLogger::create call.
Sourcepub fn log_step(
&mut self,
node_id: ProofNodeId,
step: &ProofStep,
) -> LoggingResult<()>
pub fn log_step( &mut self, node_id: ProofNodeId, step: &ProofStep, ) -> LoggingResult<()>
Append a single ProofStep to the log.
node_id is the ProofNodeId assigned to this step in the live proof
DAG; it is recorded so that cross-references in Inference premises can
be resolved during replay.
§Errors
Returns LoggingError::AlreadyClosed if called after close().
Sourcepub fn flush(&mut self) -> LoggingResult<()>
pub fn flush(&mut self) -> LoggingResult<()>
Flush the internal write buffer to the OS.
Under normal operation you do not need to call this explicitly;
close() flushes before closing. Call flush() for crash-safety
checkpointing during long-running solves.
Sourcepub fn close(&mut self) -> LoggingResult<()>
pub fn close(&mut self) -> LoggingResult<()>
Flush and close the log file.
After this call, further log_step calls will return
LoggingError::AlreadyClosed.
Sourcepub fn step_count(&self) -> u64
pub fn step_count(&self) -> u64
Return the number of proof steps written since this logger was created.