Files
orchid/orchid-api/src/logging.rs
Lawrence Bethlenfalvy 1a7230ce9b Traditional route appears to work
Beginnings of dylib extensions, entirely untestted
2026-01-12 01:38:10 +01:00

31 lines
740 B
Rust

use std::collections::HashMap;
use orchid_api_derive::{Coding, Hierarchy};
use crate::{ExtHostNotif, TStr};
/// Describes what to do with a log stream.
/// Log streams are unstructured utf8 text unless otherwise stated.
#[derive(Clone, Debug, Coding, PartialEq, Eq, Hash)]
pub enum LogStrategy {
/// Context-dependent default stream, often stderr
Default,
/// A file on the local filesystem
File { path: String, append: bool },
/// Discard any log output
Discard,
}
#[derive(Clone, Debug, Coding)]
pub struct Logger {
pub routing: HashMap<String, LogStrategy>,
pub default: Option<LogStrategy>,
}
#[derive(Clone, Debug, Coding, Hierarchy)]
#[extends(ExtHostNotif)]
pub struct Log {
pub category: TStr,
pub message: String,
}