Skip to main content

jay_config/
logging.rs

1//! Tools for modifying the logging behavior of the compositor.
2//!
3//! Note that you can use the `log` crate for logging. All invocations of `log::info` etc.
4//! automatically log into the compositors log.
5
6use {
7    serde::{Deserialize, Serialize},
8    std::time::SystemTime,
9};
10
11/// The log level of the compositor or a log message.
12#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
13pub enum LogLevel {
14    Error,
15    Warn,
16    Info,
17    Debug,
18    Trace,
19}
20
21/// Sets the log level of the compositor.
22pub fn set_log_level(level: LogLevel) {
23    get!().set_log_level(level);
24}
25
26/// If this function is called during startup, Jay's log files before `time` are deleted.
27///
28/// The current log file is never deleted, nor are any other logfiles of active Jay instances (e.g.
29/// on another VT), even if `time` is in the future.
30///
31/// Calling this function after startup has no effect.
32pub fn clean_logs_older_than(time: SystemTime) {
33    get!().clean_logs_older_than(time);
34}