Commit
Author: Kevin Schoon [me@kevinschoon.com]
Hash: 51dd4c6d70395fccc90a5a1c98fee4d9526db0ca
Timestamp: Wed, 09 Oct 2024 10:55:31 +0000 (2 months ago)

+6 -1 +/-3 browse
expose log level in maitred-debug config
1diff --git a/maitred-debug/src/config.rs b/maitred-debug/src/config.rs
2index aac99a0..d4c69b0 100644
3--- a/maitred-debug/src/config.rs
4+++ b/maitred-debug/src/config.rs
5 @@ -25,6 +25,7 @@ pub(crate) struct Tls {
6 #[derive(serde::Deserialize)]
7 pub(crate) struct Config {
8 pub address: String,
9+ pub level: String,
10 pub maildir: String,
11 pub spf: Spf,
12 pub dkim: Dkim,
13 diff --git a/maitred-debug/src/main.rs b/maitred-debug/src/main.rs
14index d5cba30..cd5d2bf 100644
15--- a/maitred-debug/src/main.rs
16+++ b/maitred-debug/src/main.rs
17 @@ -1,6 +1,7 @@
18 use std::collections::BTreeMap;
19 use std::fs::read_to_string;
20 use std::path::Path;
21+ use std::str::FromStr;
22
23 use clap::Parser;
24 use maildir::Maildir;
25 @@ -89,7 +90,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
26 tracing_subscriber::fmt()
27 .compact()
28 .with_line_number(true)
29- .with_max_level(Level::DEBUG)
30+ .with_max_level(Level::from_str(&config.level)?)
31 .init();
32 let accounts = config.accounts.clone();
33 let addresses: Vec<String> = accounts
34 diff --git a/maitred.toml b/maitred.toml
35index 785fa42..f785cc7 100644
36--- a/maitred.toml
37+++ b/maitred.toml
38 @@ -1,6 +1,9 @@
39 # Path of the directory to deliver mail in the "maildir" format to
40 maildir = "mail"
41
42+ # logging level
43+ # level = "TRACE"
44+
45 # address to bind to
46 address = "0.0.0.0:2525"
47