Skip to main content

aura_effects/
console.rs

1//! Console effect handlers
2//!
3//! This module provides standard implementations of the `ConsoleEffects` trait
4//! defined in `aura-core`. These handlers can be used by choreographic applications
5//! and other Aura components.
6
7use async_trait::async_trait;
8use aura_core::{effects::ConsoleEffects, AuraError};
9
10/// Real console handler using actual tracing
11#[derive(Debug, Clone)]
12pub struct RealConsoleHandler;
13
14impl Default for RealConsoleHandler {
15    fn default() -> Self {
16        Self::new()
17    }
18}
19
20impl RealConsoleHandler {
21    /// Create a new real console handler
22    pub fn new() -> Self {
23        Self
24    }
25}
26
27#[async_trait]
28impl ConsoleEffects for RealConsoleHandler {
29    async fn log_info(&self, message: &str) -> Result<(), AuraError> {
30        tracing::info!("{}", message);
31        Ok(())
32    }
33
34    async fn log_warn(&self, message: &str) -> Result<(), AuraError> {
35        tracing::warn!("{}", message);
36        Ok(())
37    }
38
39    async fn log_error(&self, message: &str) -> Result<(), AuraError> {
40        tracing::error!("{}", message);
41        Ok(())
42    }
43
44    async fn log_debug(&self, message: &str) -> Result<(), AuraError> {
45        tracing::debug!("{}", message);
46        Ok(())
47    }
48}