logger: add cgroup option

This commit is contained in:
Mikaël Cluseau
2026-04-13 21:11:07 +02:00
parent 33fcfbd197
commit dc936f52ab
8 changed files with 123 additions and 26 deletions
+18 -3
View File
@@ -5,16 +5,26 @@ use tokio::sync::mpsc;
pub type Result<T> = std::result::Result<T, Error>;
pub use tokio::fs::ReadDir;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("{0}: read_dir: {1}")]
#[error("{0}: read dir: {1}")]
ReadDir(PathBuf, std::io::Error),
#[error("{0}: exists: {1}")]
Exists(PathBuf, std::io::Error),
#[error("{0}: read: {1}")]
Read(PathBuf, std::io::Error),
#[error("{0}: stat: {1}")]
Stat(PathBuf, std::io::Error),
#[error("{0}: create dir: {1}")]
CreateDir(PathBuf, std::io::Error),
#[error("{0}: write: {1}")]
Write(PathBuf, std::io::Error),
#[error("{0}: remove file: {1}")]
RemoveFile(PathBuf, std::io::Error),
#[error("{0}: symlink: {1}")]
Symlink(PathBuf, std::io::Error),
#[error("{0}: {1}")]
Other(PathBuf, String),
}
@@ -28,10 +38,15 @@ macro_rules! wrap_path {
};
}
wrap_path!(read_dir -> fs::ReadDir, ReadDir);
wrap_path!(read_dir -> ReadDir, ReadDir);
wrap_path!(try_exists -> bool, Exists);
wrap_path!(read -> Vec<u8>, Read);
wrap_path!(read_to_string -> String, Read);
wrap_path!(write(content: &[u8]) -> (), Write);
wrap_path!(create_dir -> (), CreateDir);
wrap_path!(create_dir_all -> (), CreateDir);
wrap_path!(remove_file -> (), RemoveFile);
wrap_path!(symlink(link_src: impl AsRef<Path>) -> (), Symlink);
wrap_path!(write(content: impl AsRef<[u8]>) -> (), Write);
pub fn spawn_walk_dir(
dir: impl Into<PathBuf> + Send + 'static,