Skip to main content

ExecutionLogger

Struct ExecutionLogger 

Source
pub struct ExecutionLogger {
    pub unmet_condition_level: Option<Level>,
    pub unmet_condition_message: String,
    pub prepare_failed_level: Option<Level>,
    pub prepare_failed_message: String,
    pub prepare_commit_failed_level: Option<Level>,
    pub prepare_commit_failed_message: String,
    pub prepare_rollback_failed_level: Option<Level>,
    pub prepare_rollback_failed_message: String,
}
Expand description

Logger for double-checked execution (condition unmet, prepare failures, prepare commit failures, and prepare rollback failures).

Each event has its own optional log::Level and message. None means that event does not emit logs. For prepare-style events the message is a prefix formatted as "{prefix}: {error}".

ExecutionLogger::default matches the previous Option logger unset behavior: condition-unmet is silent (None); prepare lifecycle lines use log::Level::Error with English default prefixes.

§Author

Haixing Hu

Fields§

§unmet_condition_level: Option<Level>

Log level for the condition-unmet message; None skips it.

§unmet_condition_message: String

Message logged when the execution condition is not met.

§prepare_failed_level: Option<Level>

Log level for prepare-action failure lines; None skips them.

§prepare_failed_message: String

Prefix for prepare-failure lines, formatted as "{prefix}: {error}".

§prepare_commit_failed_level: Option<Level>

Log level for prepare-commit failure lines; None skips them.

§prepare_commit_failed_message: String

Prefix for prepare-commit failure lines, formatted as "{prefix}: {error}".

§prepare_rollback_failed_level: Option<Level>

Log level for prepare-rollback failure lines; None skips them.

§prepare_rollback_failed_message: String

Prefix for prepare-rollback failure lines, formatted as "{prefix}: {error}".

Implementations§

Source§

impl ExecutionLogger

Source

pub fn set_unmet_condition( &mut self, level: Option<Level>, message: impl Into<String>, )

Updates logging for the case where the double-checked condition is not met (the tester returns false before or after taking the lock).

When Self::unmet_condition_level is None, Self::log_unmet_condition becomes a no-op. The message is still stored and used if the level is set to Some later.

§Parameters
  • level - Optional severity for the line written through the log crate, or None to disable this event.
  • message - Full line text (not a prefix); passed to log::log! as the format argument when logging runs.
Source

pub fn set_prepare_failure( &mut self, level: Option<Level>, message_prefix: impl Into<String>, )

Updates logging for a failed optional prepare action (before the lock is taken).

When Self::prepare_failed_level is None, Self::log_prepare_failed becomes a no-op.

§Parameters
  • level - Optional severity for the diagnostic line, or None to disable.
  • message_prefix - Text placed before the error; the emitted line has the form "{prefix}: {error}".
Source

pub fn set_prepare_commit_failure( &mut self, level: Option<Level>, message_prefix: impl Into<String>, )

Updates logging for a failed prepare commit action (after a successful task when prepare had completed).

When Self::prepare_commit_failed_level is None, Self::log_prepare_commit_failed becomes a no-op.

§Parameters
  • level - Optional severity for the diagnostic line, or None to disable.
  • message_prefix - Text placed before the error; the emitted line has the form "{prefix}: {error}".
Source

pub fn set_prepare_rollback_failure( &mut self, level: Option<Level>, message_prefix: impl Into<String>, )

Updates logging for a failed prepare rollback action (after a failed second check or task when prepare had completed).

When Self::prepare_rollback_failed_level is None, Self::log_prepare_rollback_failed becomes a no-op.

§Parameters
  • level - Optional severity for the diagnostic line, or None to disable.
  • message_prefix - Text placed before the error; the emitted line has the form "{prefix}: {error}".
Source

pub fn log_unmet_condition(&self)

Emits the condition-unmet log line if enabled.

Does nothing when Self::unmet_condition_level is None. Otherwise writes Self::unmet_condition_message through the log facade at the configured level, subject to the crate-wide maximum log level (for example set via log::set_max_level or compile-time filters).

Source

pub fn log_prepare_failed<E: Display>(&self, err: E)

Emits a diagnostic line when the prepare action fails.

Does nothing when Self::prepare_failed_level is None. Otherwise logs "{prefix}: {err}" at the configured level via the log facade, where prefix is Self::prepare_failed_message, subject to the crate-wide maximum log level.

§Type Parameters
  • E - Displayable error or message value appended after the prefix.
§Parameters
  • err - Failure to record next to the configured prefix.
Source

pub fn log_prepare_commit_failed<E: Display>(&self, err: E)

Emits a diagnostic line when the prepare commit action fails.

Does nothing when Self::prepare_commit_failed_level is None. Otherwise logs "{prefix}: {err}" at the configured level, where prefix is Self::prepare_commit_failed_message, subject to the crate-wide maximum log level.

§Type Parameters
  • E - Displayable error or message value appended after the prefix.
§Parameters
  • err - Commit failure to record next to the configured prefix.
Source

pub fn log_prepare_rollback_failed<E: Display>(&self, err: E)

Emits a diagnostic line when the prepare rollback action fails.

Does nothing when Self::prepare_rollback_failed_level is None. Otherwise logs "{prefix}: {err}" at the configured level, where prefix is Self::prepare_rollback_failed_message, subject to the crate-wide maximum log level.

§Type Parameters
  • E - Displayable error or message value appended after the prefix.
§Parameters
  • err - Rollback failure to record next to the configured prefix.

Trait Implementations§

Source§

impl Clone for ExecutionLogger

Source§

fn clone(&self) -> ExecutionLogger

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExecutionLogger

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExecutionLogger

Source§

fn default() -> Self

Returns the logger configuration used when the executor builder does not apply any logging overrides.

Condition-unmet logging is disabled (ExecutionLogger::unmet_condition_level is None). Prepare lifecycle failures log at log::Level::Error with short English default prefixes (see the field defaults on ExecutionLogger).

§Returns

A new ExecutionLogger with the values described above.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.