@@ -14,11 +14,33 @@ pub struct MetadataConfig {
14
14
pub max_parallel_fetch_connections : usize ,
15
15
}
16
16
17
+ #[ derive( Deserialize , Debug ) ]
18
+ pub struct DebugLogConfig {
19
+ pub enable : bool ,
20
+ pub path : String ,
21
+ pub prefix : String ,
22
+ pub level : String ,
23
+ }
24
+
25
+ impl DebugLogConfig {
26
+ pub fn tracing_level ( & self ) -> tracing:: Level {
27
+ match self . level . to_uppercase ( ) . trim ( ) {
28
+ "TRACE" => tracing:: Level :: TRACE ,
29
+ "DEBUG" => tracing:: Level :: DEBUG ,
30
+ "INFO" => tracing:: Level :: INFO ,
31
+ "WARN" => tracing:: Level :: WARN ,
32
+ "ERROR" => tracing:: Level :: ERROR ,
33
+ _ => tracing:: Level :: ERROR ,
34
+ }
35
+ }
36
+ }
37
+
17
38
#[ derive( Deserialize , Debug ) ]
18
39
pub struct ServerConfig {
19
40
pub bind_address : String ,
20
41
pub storage_format : StorageFormat ,
21
42
pub metadata : MetadataConfig ,
43
+ pub debug_log : DebugLogConfig ,
22
44
}
23
45
24
46
impl ServerConfig {
@@ -28,6 +50,10 @@ impl ServerConfig {
28
50
. set_default ( "storage_format.type" , "json" ) ?
29
51
. set_default ( "storage_format.meta_directory" , "meta" ) ?
30
52
. set_default ( "metadata.max_parallel_fetch_connections" , 4 ) ?
53
+ . set_default ( "debug_log.enable" , false ) ?
54
+ . set_default ( "debug_log.path" , "./logs" ) ?
55
+ . set_default ( "debug_log.prefix" , "mcmeta.log" ) ?
56
+ . set_default ( "debug_log.level" , "debug" ) ?
31
57
. add_source ( config:: File :: new (
32
58
"config/settings" ,
33
59
config:: FileFormat :: Json ,
0 commit comments