|
16 | 16 | //! |
17 | 17 | //! Requires the `rolling_file_appender` feature. |
18 | 18 |
|
19 | | -use derive_more::Debug; |
20 | 19 | use log::Record; |
21 | 20 | use parking_lot::Mutex; |
| 21 | +use core::fmt; |
22 | 22 | use std::{ |
23 | 23 | fs::{self, File, OpenOptions}, |
24 | 24 | io::{self, BufWriter, Write}, |
@@ -150,16 +150,25 @@ impl<'a> LogFile<'a> { |
150 | 150 | } |
151 | 151 |
|
152 | 152 | /// An appender which archives log files in a configurable strategy. |
153 | | -#[derive(Debug)] |
154 | 153 | pub struct RollingFileAppender { |
155 | | - #[debug(skip)] |
156 | 154 | writer: Mutex<Option<LogWriter>>, |
157 | 155 | path: PathBuf, |
158 | 156 | append: bool, |
159 | 157 | encoder: Box<dyn Encode>, |
160 | 158 | policy: Box<dyn policy::Policy>, |
161 | 159 | } |
162 | 160 |
|
| 161 | +impl fmt::Debug for RollingFileAppender { |
| 162 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 163 | + f.debug_struct("RollingFileAppender") |
| 164 | + .field("path", &self.path) |
| 165 | + .field("append", &self.append) |
| 166 | + .field("encoder", &self.encoder) |
| 167 | + .field("policy", &self.policy) |
| 168 | + .finish() |
| 169 | + } |
| 170 | +} |
| 171 | + |
163 | 172 | impl Append for RollingFileAppender { |
164 | 173 | fn append(&self, record: &Record<'_>) -> anyhow::Result<()> { |
165 | 174 | // TODO(eas): Perhaps this is better as a concurrent queue? |
@@ -365,7 +374,6 @@ impl Deserialize for RollingFileAppenderDeserializer { |
365 | 374 |
|
366 | 375 | #[cfg(test)] |
367 | 376 | mod test { |
368 | | - use derive_more::Debug; |
369 | 377 | use std::{ |
370 | 378 | fs::File, |
371 | 379 | io::{Read, Write}, |
|
0 commit comments