From 3a56190257eb94ca7d95acf10cdac1f8f4d5435b Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 15 Jan 2024 18:00:52 +0200 Subject: [PATCH] refactor: rename LogFile to AdminLog Signed-off-by: Lars Wirzenius --- src/bin/radicle-native-ci.rs | 10 +++++----- src/config.rs | 6 +++--- src/logfile.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/bin/radicle-native-ci.rs b/src/bin/radicle-native-ci.rs index 67ba887..fcaa051 100644 --- a/src/bin/radicle-native-ci.rs +++ b/src/bin/radicle-native-ci.rs @@ -24,7 +24,7 @@ use radicle_ci_broker::msg::{Id, Oid, Request, RunId, RunResult}; use radicle_native_ci::{ config::{Config, ConfigError}, - logfile::{LogError, LogFile}, + logfile::{AdminLog, LogError}, msg::{ read_request, write_errored, write_failed, write_succeeded, write_triggered, NativeMessageError, @@ -81,7 +81,7 @@ fn fallible_main() -> Result<(), NativeError> { fn fallible_main_inner( config: &Config, - logfile: &mut LogFile, + logfile: &mut AdminLog, builder: &mut RunInfoBuilder, ) -> Result<(), NativeError> { let (run_id, run_dir) = mkdir_run(config)?; @@ -154,7 +154,7 @@ struct Runner<'a> { repo: Id, commit: Oid, src: PathBuf, - log: &'a mut LogFile, + log: &'a mut AdminLog, run_log: RunLog, timeout: Option, builder: &'a mut RunInfoBuilder, @@ -252,7 +252,7 @@ struct RunnerBuilder<'a> { repo: Option, commit: Option, src: Option, - log: Option<&'a mut LogFile>, + log: Option<&'a mut AdminLog>, run_log: Option, timeout: Option, builder: Option<&'a mut RunInfoBuilder>, @@ -284,7 +284,7 @@ impl<'a> RunnerBuilder<'a> { self } - fn log(mut self, log: &'a mut LogFile) -> Self { + fn log(mut self, log: &'a mut AdminLog) -> Self { self.log = Some(log); self } diff --git a/src/config.rs b/src/config.rs index 621ce20..5da4db4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf}; use serde::Deserialize; -use crate::logfile::{LogError, LogFile}; +use crate::logfile::{AdminLog, LogError}; const DEFAULT_TIMEOUT: usize = 3600; @@ -30,8 +30,8 @@ impl Config { Ok(config) } - pub fn open_log(&self) -> Result { - Ok(LogFile::open(&self.log)?) + pub fn open_log(&self) -> Result { + Ok(AdminLog::open(&self.log)?) } /// Read configuration specification from a file. diff --git a/src/logfile.rs b/src/logfile.rs index 3391e20..c147e8a 100644 --- a/src/logfile.rs +++ b/src/logfile.rs @@ -5,12 +5,12 @@ use std::{ }; #[derive(Debug)] -pub struct LogFile { +pub struct AdminLog { filename: PathBuf, file: File, } -impl LogFile { +impl AdminLog { pub fn open(filename: &Path) -> Result { let file = OpenOptions::new() .append(true)