pub struct CheckLogger<'a> { /* private fields */ }Expand description
Stateless per-call façade over an explicitly borrowed LoggingOptions value.
A logger with no options is disabled and every method becomes a no-op. This value never reads global configuration and can be created independently for concurrent checks.
Implementations§
Source§impl<'a> CheckLogger<'a>
impl<'a> CheckLogger<'a>
Sourcepub const fn new(options: Option<&'a LoggingOptions>) -> Self
pub const fn new(options: Option<&'a LoggingOptions>) -> Self
Creates a logger from this check’s optional configuration.
Sourcepub const fn is_enabled(&self) -> bool
pub const fn is_enabled(&self) -> bool
Returns whether this check opted into logging.
Sourcepub fn validate(&self) -> Result<(), ArchUnitError>
pub fn validate(&self) -> Result<(), ArchUnitError>
Validates the explicitly configured sinks without emitting a record.
Built-in architecture checks call this before project discovery. Custom crate::Checkable
implementations can do the same when they use this logger directly.
Sourcepub fn start_check(
&self,
rule_name: impl AsRef<str>,
) -> Result<(), ArchUnitError>
pub fn start_check( &self, rule_name: impl AsRef<str>, ) -> Result<(), ArchUnitError>
Logs the beginning of one named architecture check.
Sourcepub fn end_check(
&self,
rule_name: impl AsRef<str>,
violation_count: usize,
) -> Result<(), ArchUnitError>
pub fn end_check( &self, rule_name: impl AsRef<str>, violation_count: usize, ) -> Result<(), ArchUnitError>
Logs the completed verdict and its violation count.
Sourcepub fn log_progress(
&self,
message: impl AsRef<str>,
) -> Result<(), ArchUnitError>
pub fn log_progress( &self, message: impl AsRef<str>, ) -> Result<(), ArchUnitError>
Logs detailed execution progress at debug level.
Sourcepub fn log_violation(
&self,
message: impl AsRef<str>,
) -> Result<(), ArchUnitError>
pub fn log_violation( &self, message: impl AsRef<str>, ) -> Result<(), ArchUnitError>
Logs one architecture violation at warning level.
Sourcepub fn log_metric(
&self,
metric_name: impl AsRef<str>,
subject: impl AsRef<str>,
value: f64,
threshold: Option<f64>,
) -> Result<(), ArchUnitError>
pub fn log_metric( &self, metric_name: impl AsRef<str>, subject: impl AsRef<str>, value: f64, threshold: Option<f64>, ) -> Result<(), ArchUnitError>
Logs one calculated metric value at debug level.
Sourcepub fn debug(&self, message: impl AsRef<str>) -> Result<(), ArchUnitError>
pub fn debug(&self, message: impl AsRef<str>) -> Result<(), ArchUnitError>
Logs an ordinary debug message.
Sourcepub fn info(&self, message: impl AsRef<str>) -> Result<(), ArchUnitError>
pub fn info(&self, message: impl AsRef<str>) -> Result<(), ArchUnitError>
Logs an ordinary informational message.
Trait Implementations§
Source§impl<'a> Clone for CheckLogger<'a>
impl<'a> Clone for CheckLogger<'a>
Source§fn clone(&self) -> CheckLogger<'a>
fn clone(&self) -> CheckLogger<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more