pub struct ImageAuditLogger { /* private fields */ }Expand description
Image analysis audit logger.
This logger tracks:
- Image analysis requests (provider, model, image count, size)
- Analysis responses (success/failure, tokens used)
- Cache operations (hits, misses, evictions)
- Security events (path traversal attempts, invalid formats)
Implementations§
Source§impl ImageAuditLogger
impl ImageAuditLogger
Sourcepub fn log_analysis_request(
&self,
provider: &str,
model: &str,
image_count: usize,
total_size: u64,
image_hashes: Vec<String>,
) -> Result<(), Box<dyn Error>>
pub fn log_analysis_request( &self, provider: &str, model: &str, image_count: usize, total_size: u64, image_hashes: Vec<String>, ) -> Result<(), Box<dyn Error>>
Log an image analysis request.
§Arguments
provider- Provider name (openai, anthropic, etc.)model- Model identifierimage_count- Number of images being analyzedtotal_size- Total size of all images in bytesimage_hashes- SHA256 hashes of images (for deduplication tracking)
Sourcepub fn log_analysis_success(
&self,
provider: &str,
model: &str,
image_count: usize,
tokens_used: u32,
image_hashes: Vec<String>,
) -> Result<(), Box<dyn Error>>
pub fn log_analysis_success( &self, provider: &str, model: &str, image_count: usize, tokens_used: u32, image_hashes: Vec<String>, ) -> Result<(), Box<dyn Error>>
Log a successful image analysis response.
§Arguments
provider- Provider namemodel- Model identifierimage_count- Number of images analyzedtokens_used- Tokens used for the analysisimage_hashes- SHA256 hashes of analyzed images
Sourcepub fn log_analysis_failure(
&self,
provider: &str,
model: &str,
image_count: usize,
error: &str,
image_hashes: Vec<String>,
) -> Result<(), Box<dyn Error>>
pub fn log_analysis_failure( &self, provider: &str, model: &str, image_count: usize, error: &str, image_hashes: Vec<String>, ) -> Result<(), Box<dyn Error>>
Log a failed image analysis response.
§Arguments
provider- Provider namemodel- Model identifierimage_count- Number of images that failederror- Error messageimage_hashes- SHA256 hashes of images that failed
Sourcepub fn log_cache_hit(
&self,
image_hash: &str,
provider: &str,
age_seconds: u64,
) -> Result<(), Box<dyn Error>>
pub fn log_cache_hit( &self, image_hash: &str, provider: &str, age_seconds: u64, ) -> Result<(), Box<dyn Error>>
Log a cache hit.
§Arguments
image_hash- SHA256 hash of the imageprovider- Provider that originally analyzed the imageage_seconds- Age of the cached result in seconds
Sourcepub fn log_cache_eviction(
&self,
image_hash: &str,
reason: &str,
) -> Result<(), Box<dyn Error>>
pub fn log_cache_eviction( &self, image_hash: &str, reason: &str, ) -> Result<(), Box<dyn Error>>
Log a cache eviction.
§Arguments
image_hash- SHA256 hash of the evicted imagereason- Reason for eviction (e.g., “LRU”, “TTL_expired”)
Sourcepub fn log_invalid_format(
&self,
file_path: &str,
format: &str,
) -> Result<(), Box<dyn Error>>
pub fn log_invalid_format( &self, file_path: &str, format: &str, ) -> Result<(), Box<dyn Error>>
Log an invalid image format attempt.
§Arguments
file_path- Path to the fileformat- Format that was attempted
Sourcepub fn log_file_size_violation(
&self,
file_path: &str,
size_bytes: u64,
max_size_bytes: u64,
) -> Result<(), Box<dyn Error>>
pub fn log_file_size_violation( &self, file_path: &str, size_bytes: u64, max_size_bytes: u64, ) -> Result<(), Box<dyn Error>>
Log a file size violation.
§Arguments
file_path- Path to the filesize_bytes- Size of the file in bytesmax_size_bytes- Maximum allowed size in bytes
Sourcepub fn log_path_traversal_attempt(
&self,
attempted_path: &str,
) -> Result<(), Box<dyn Error>>
pub fn log_path_traversal_attempt( &self, attempted_path: &str, ) -> Result<(), Box<dyn Error>>
Sourcepub fn log_analysis_timeout(
&self,
provider: &str,
model: &str,
timeout_seconds: u64,
image_hashes: Vec<String>,
) -> Result<(), Box<dyn Error>>
pub fn log_analysis_timeout( &self, provider: &str, model: &str, timeout_seconds: u64, image_hashes: Vec<String>, ) -> Result<(), Box<dyn Error>>
Log an image analysis timeout.
§Arguments
provider- Provider namemodel- Model identifiertimeout_seconds- Timeout duration in secondsimage_hashes- SHA256 hashes of images that timed out
Sourcepub fn audit_logger(&self) -> &AuditLogger
pub fn audit_logger(&self) -> &AuditLogger
Get the underlying audit logger.
Auto Trait Implementations§
impl Freeze for ImageAuditLogger
impl RefUnwindSafe for ImageAuditLogger
impl Send for ImageAuditLogger
impl Sync for ImageAuditLogger
impl Unpin for ImageAuditLogger
impl UnwindSafe for ImageAuditLogger
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more