1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
//! Abscissa logging component

// TODO(tarcieri): logfile support?

use super::{config::Config, logger};
use crate::{Component, FrameworkError};

/// Abscissa component for initializing the logging subsystem
#[derive(Component, Debug, Default)]
#[component(core)]
pub struct Logging {
    config: Config,
}

impl Logging {
    /// Create a new logging component
    pub fn new(config: Config) -> Result<Self, FrameworkError> {
        logger::init(&config);
        Ok(Self { config })
    }
}