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 serde::Deserialize;
7use serde::Serialize;
8use std::time::SystemTime;
9
10/// The log level of the compositor or a log message.
11#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
12pub enum LogLevel {
13    Error,
14    Warn,
15    Info,
16    Debug,
17    Trace,
18}
19
20/// Sets the log level of the compositor.
21pub fn set_log_level(level: LogLevel) {
22    get!().set_log_level(level);
23}
24
25/// If this function is called during startup, Jay's log files before `time` are deleted.
26///
27/// The current log file is never deleted, nor are any other logfiles of active Jay instances (e.g.
28/// on another VT), even if `time` is in the future.
29///
30/// Calling this function after startup has no effect.
31pub fn clean_logs_older_than(time: SystemTime) {
32    get!().clean_logs_older_than(time);
33}