Add clean-logs-older-than option
This commit is contained in:
parent
4c7d108e09
commit
880c98ecfb
17 changed files with 360 additions and 10 deletions
|
|
@ -60,7 +60,7 @@ use {
|
|||
atomic::{AtomicBool, Ordering::Relaxed},
|
||||
},
|
||||
task::{Context, Poll, Waker},
|
||||
time::Duration,
|
||||
time::{Duration, SystemTime},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -776,6 +776,10 @@ impl ConfigClient {
|
|||
self.send(&ClientMessage::SetLogLevel { level })
|
||||
}
|
||||
|
||||
pub fn clean_logs_older_than(&self, time: SystemTime) {
|
||||
self.send(&ClientMessage::CleanLogsOlderThan { time })
|
||||
}
|
||||
|
||||
pub fn unset_env(&self, key: &str) {
|
||||
self.send(&ClientMessage::UnsetEnv { key });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use {
|
|||
xwayland::XScalingMode,
|
||||
},
|
||||
serde::{Deserialize, Serialize},
|
||||
std::time::Duration,
|
||||
std::time::{Duration, SystemTime},
|
||||
};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
|
||||
|
|
@ -861,6 +861,9 @@ pub enum ClientMessage<'a> {
|
|||
SeatWarpMouseToFocus {
|
||||
seat: Seat,
|
||||
},
|
||||
CleanLogsOlderThan {
|
||||
time: SystemTime,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@
|
|||
//! Note that you can use the `log` crate for logging. All invocations of `log::info` etc.
|
||||
//! automatically log into the compositors log.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use {
|
||||
serde::{Deserialize, Serialize},
|
||||
std::time::SystemTime,
|
||||
};
|
||||
|
||||
/// The log level of the compositor or a log message.
|
||||
#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||
|
|
@ -19,3 +22,13 @@ pub enum LogLevel {
|
|||
pub fn set_log_level(level: LogLevel) {
|
||||
get!().set_log_level(level);
|
||||
}
|
||||
|
||||
/// If this function is called during startup, Jay's log files before `time` are deleted.
|
||||
///
|
||||
/// The current log file is never deleted, nor are any other logfiles of active Jay instances (e.g.
|
||||
/// on another VT), even if `time` is in the future.
|
||||
///
|
||||
/// Calling this function after startup has no effect.
|
||||
pub fn clean_logs_older_than(time: SystemTime) {
|
||||
get!().clean_logs_older_than(time);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue