1 | /// Log target, either `stdout`, `stderr` or a custom pipe. |
2 | #[non_exhaustive ] |
3 | #[derive (Default)] |
4 | pub enum Target { |
5 | /// Logs will be sent to standard output. |
6 | Stdout, |
7 | /// Logs will be sent to standard error. |
8 | #[default] |
9 | Stderr, |
10 | /// Logs will be sent to a custom pipe. |
11 | Pipe(Box<dyn std::io::Write + Send + 'static>), |
12 | } |
13 | |
14 | impl std::fmt::Debug for Target { |
15 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
16 | write!( |
17 | f, |
18 | " {}" , |
19 | match self { |
20 | Self::Stdout => "stdout" , |
21 | Self::Stderr => "stderr" , |
22 | Self::Pipe(_) => "pipe" , |
23 | } |
24 | ) |
25 | } |
26 | } |
27 | |