Skip to main content

WithLogger

Trait WithLogger 

Source
pub trait WithLogger {
    // Provided methods
    fn logger_name(&self) -> &str { ... }
    fn log_info(&self, msg: &str) { ... }
    fn log_debug(&self, msg: &str) { ... }
    fn log_warning(&self, msg: &str) { ... }
    fn log_error(&self, msg: &str) { ... }
}
Expand description

Trait for types that can have logging capabilities

This trait provides a standard way to add logging to any type. It’s the Rust equivalent of Python’s WithLogger mixin class.

§Examples

use composio_sdk::logging::WithLogger;

struct MyService {
    logger_name: String,
}

impl WithLogger for MyService {
    fn logger_name(&self) -> &str {
        &self.logger_name
    }
}

Provided Methods§

Source

fn logger_name(&self) -> &str

Get the logger name for this type

Source

fn log_info(&self, msg: &str)

Log an info message with truncation

Source

fn log_debug(&self, msg: &str)

Log a debug message with truncation

Source

fn log_warning(&self, msg: &str)

Log a warning message (no truncation for warnings)

Source

fn log_error(&self, msg: &str)

Log an error message (no truncation for errors)

Implementors§