Ensure logfile permissions are maintained after rotation (#7246)

Update our `logroller` dependency to the new version which supports permission control. See -> https://github.com/trayvonpan/logroller/pull/6
This commit is contained in:
Mac L
2025-05-22 12:51:28 +10:00
committed by GitHub
parent cf0f959855
commit ce8d0814ad
5 changed files with 19 additions and 53 deletions

View File

@@ -59,6 +59,7 @@ impl tracing_core::field::Visit for LogMessageExtractor {
pub fn create_libp2p_discv5_tracing_layer(
base_tracing_log_path: Option<PathBuf>,
max_log_size: u64,
file_mode: u32,
) -> Option<Libp2pDiscv5TracingLayer> {
if let Some(mut tracing_log_path) = base_tracing_log_path {
// Ensure that `tracing_log_path` only contains directories.
@@ -75,12 +76,14 @@ pub fn create_libp2p_discv5_tracing_layer(
let libp2p_writer =
LogRollerBuilder::new(tracing_log_path.clone(), PathBuf::from("libp2p.log"))
.rotation(Rotation::SizeBased(RotationSize::MB(max_log_size)))
.max_keep_files(1);
.max_keep_files(1)
.file_mode(file_mode);
let discv5_writer =
LogRollerBuilder::new(tracing_log_path.clone(), PathBuf::from("discv5.log"))
.rotation(Rotation::SizeBased(RotationSize::MB(max_log_size)))
.max_keep_files(1);
.max_keep_files(1)
.file_mode(file_mode);
let libp2p_writer = match libp2p_writer.build() {
Ok(writer) => writer,