akita 0.7.0

Akita - Mini orm for rust.
Documentation
/*
 *
 *  *
 *  *      Copyright (c) 2018-2025, SnackCloud All rights reserved.
 *  *
 *  *   Redistribution and use in source and binary forms, with or without
 *  *   modification, are permitted provided that the following conditions are met:
 *  *
 *  *   Redistributions of source code must retain the above copyright notice,
 *  *   this list of conditions and the following disclaimer.
 *  *   Redistributions in binary form must reproduce the above copyright
 *  *   notice, this list of conditions and the following disclaimer in the
 *  *   documentation and/or other materials provided with the distribution.
 *  *   Neither the name of the www.snackcloud.cn developer nor the names of its
 *  *   contributors may be used to endorse or promote products derived from
 *  *   this software without specific prior written permission.
 *  *   Author: SnackCloud
 *  *
 *
 */
use crate::comm::ExecuteContext;
use crate::errors::{AkitaError, Result};
use crate::interceptor::shared::InterceptorBase;
use crate::interceptor::{InterceptorType, LogLevel, OperationType};
use crate::prelude::ExecuteResult;

/// Simplified log interceptor - Focus on SQL execution logs
pub struct LoggingInterceptor {
    pub slow_query_threshold_ms: u64,
}

impl LoggingInterceptor {
    pub fn new() -> Self {
        Self {
            slow_query_threshold_ms: 1000,
        }
    }

    pub fn with_slow_query_threshold(mut self, threshold_ms: u64) -> Self {
        self.slow_query_threshold_ms = threshold_ms;
        self
    }
}

impl Default for LoggingInterceptor {
    fn default() -> Self {
        Self::new()
    }
}

impl InterceptorBase for LoggingInterceptor {
    fn name(&self) -> &'static str {
        "logging"
    }

    fn interceptor_type(&self) -> InterceptorType {
        InterceptorType::Logging
    }

    fn order(&self) -> i32 {
        90
    }

    fn supports_operation(&self, _operation: &OperationType) -> bool {
        true
    }

    fn will_ignore_table(&self, _table_name: &str) -> bool {
        false
    }
}