Add get_filename function to AppenderConfig
In order to check that the configured log files are writeable the
filenames are needed. This function returns an option of a borrowed
string for File and RollingFile Appenders and None for all other
appenders.
@@ -94,6 +94,19 @@ pub enum RawLogTarget {
RollingFile,
}
+impl AppenderConfig {
+ pub fn get_filename(&self) -> Option<&str> {
+ match &self.kind {
+ LogTarget::File(file) => Some(file),
+ LogTarget::RollingFile {
+ filename: file,
+ size: _,
+ } => Some(file),
+ _ => None,
+ }
+ }
+}
+
impl From<TomlRawLogTarget> for RawLogTarget {
fn from(unnamed: TomlRawLogTarget) -> Self {
match unnamed {
