logger - OmniCloudOrg/OmniOrchestrator GitHub Wiki

logger (src)

Path: src/logger.rs

Table of Contents

Public Items

struct DynamicLogger

Definition

pub struct DynamicLogger {
    pub writer: Arc<Mutex<Box<dyn Write + Send>>>,
}

fn new

Definition

    pub fn new() -> Self {
        Self {
    // ... function body
}

fn write_to_file

Definition

    pub fn write_to_file(&self, file_path: &str) {
        let file = OpenOptions::new()
            .create(true)
            .append(true)
            .open(file_path)
            .expect("Failed to open log file");

fn write_to_stdout

Definition

    pub fn write_to_stdout(&self) {
        *self.writer.lock() = Box::new(io::stdout());