Trait LoggingConfigTrait

Source
pub trait LoggingConfigTrait {
    // Required method
    fn logging_config_mut(&mut self) -> &mut LoggingConfig;

    // Provided methods
    fn logging_enabled(self, enabled: bool) -> Self
       where Self: Sized { ... }
    fn logger_name<S>(self, logger_name: S) -> Self
       where S: Into<String>,
             Self: Sized { ... }
    fn log_path<P>(self, path: P) -> Self
       where P: AsRef<Path>,
             Self: Sized { ... }
    fn log_level_trace(self) -> Self
       where Self: Sized { ... }
    fn log_level_debug(self) -> Self
       where Self: Sized { ... }
    fn log_level_info(self) -> Self
       where Self: Sized { ... }
    fn log_level_warn(self) -> Self
       where Self: Sized { ... }
    fn log_level_error(self) -> Self
       where Self: Sized { ... }
}
Expand description

Trait for configuring logging behavior.

Provides a fluent interface for configuring logging settings.

Required Methods§

Provided Methods§

Source

fn logging_enabled(self, enabled: bool) -> Self
where Self: Sized,

Enables or disables logging for the configuration.

§Arguments
  • enabled - A boolean value where true enables logging and false disables it.
§Returns

Returns Self to allow for method chaining.

Source

fn logger_name<S>(self, logger_name: S) -> Self
where S: Into<String>, Self: Sized,

Sets the name of the logger.

This method allows you to specify a custom name for the logger, which can be useful for identifying the source of log messages in applications with multiple components or services.

§Arguments
  • logger_name - A string-like value that can be converted into a String. This will be used as the name for the logger.
§Returns

Returns Self to allow for method chaining.

Source

fn log_path<P>(self, path: P) -> Self
where P: AsRef<Path>, Self: Sized,

Sets the path where log files will be stored.

§Arguments
  • path - A path-like object that represents the directory where log files should be stored.
§Returns

Returns Self to allow for method chaining.

§Notes
  • If no path is set, the default path is CARGO_MANIFEST_DIRECTORY/llm_logs.
Source

fn log_level_trace(self) -> Self
where Self: Sized,

Sets the log level to TRACE.

Use TRACE for purely “I am here!” logs. They indicate the flow of execution without additional context.

TRACE logs should not be used to log variables or decisions.

Source

fn log_level_debug(self) -> Self
where Self: Sized,

Sets the log level to DEBUG.

Use DEBUG to log variables or decisions. This level is appropriate for information that is useful for debugging but not necessary for normal operation.

§Examples

DEBUG logs should focus on logging specific data points or choices made in the code.

Source

fn log_level_info(self) -> Self
where Self: Sized,

Sets the log level to INFO.

Use INFO for important runtime events that don’t prevent the application from working but are significant milestones or status updates.

INFO logs should provide a high-level overview of the application’s operation.

Source

fn log_level_warn(self) -> Self
where Self: Sized,

Sets the log level to WARN.

Use WARN for errors that were recovered from or potential issues that don’t prevent the application from working but might lead to problems if not addressed.

WARN logs often indicate situations that should be monitored or addressed soon.

Source

fn log_level_error(self) -> Self
where Self: Sized,

Sets the log level to ERROR.

Use ERROR to log errors within specific tasks that cause the task to fail but don’t crash the entire application.

ERROR logs indicate serious issues that need immediate attention but don’t necessarily stop the application.

Implementations on Foreign Types§

Source§

impl LoggingConfigTrait for AnthropicBackendBuilder

Source§

impl LoggingConfigTrait for OpenAiBackendBuilder

Source§

impl LoggingConfigTrait for PerplexityBackendBuilder

Source§

impl LoggingConfigTrait for LlamaCppBackendBuilder

Implementors§

Source§

impl LoggingConfigTrait for llm_client::backend_builders::anthropic::AnthropicBackendBuilder

Source§

impl LoggingConfigTrait for llm_client::backend_builders::llama_cpp::LlamaCppBackendBuilder

Source§

impl LoggingConfigTrait for llm_client::backend_builders::openai::OpenAiBackendBuilder

Source§

impl LoggingConfigTrait for llm_client::backend_builders::perplexity::PerplexityBackendBuilder