ImageAuditLogger

Struct ImageAuditLogger 

Source
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

Source

pub fn new(log_path: PathBuf) -> Self

Create a new image audit logger.

§Arguments
  • log_path - Path to the audit log file
Source

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 identifier
  • image_count - Number of images being analyzed
  • total_size - Total size of all images in bytes
  • image_hashes - SHA256 hashes of images (for deduplication tracking)
Source

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 name
  • model - Model identifier
  • image_count - Number of images analyzed
  • tokens_used - Tokens used for the analysis
  • image_hashes - SHA256 hashes of analyzed images
Source

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 name
  • model - Model identifier
  • image_count - Number of images that failed
  • error - Error message
  • image_hashes - SHA256 hashes of images that failed
Source

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 image
  • provider - Provider that originally analyzed the image
  • age_seconds - Age of the cached result in seconds
Source

pub fn log_cache_miss(&self, image_hash: &str) -> Result<(), Box<dyn Error>>

Log a cache miss.

§Arguments
  • image_hash - SHA256 hash of the image
Source

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 image
  • reason - Reason for eviction (e.g., “LRU”, “TTL_expired”)
Source

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 file
  • format - Format that was attempted
Source

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 file
  • size_bytes - Size of the file in bytes
  • max_size_bytes - Maximum allowed size in bytes
Source

pub fn log_path_traversal_attempt( &self, attempted_path: &str, ) -> Result<(), Box<dyn Error>>

Log a path traversal attempt.

§Arguments
  • attempted_path - The path that was attempted
Source

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 name
  • model - Model identifier
  • timeout_seconds - Timeout duration in seconds
  • image_hashes - SHA256 hashes of images that timed out
Source

pub fn audit_logger(&self) -> &AuditLogger

Get the underlying audit logger.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more