@@ -10,7 +10,7 @@ use crate::config::{ShutdownConfig, Ident, CliColors};
10
10
use crate :: request:: { self , Request , FromRequest } ;
11
11
use crate :: http:: uncased:: Uncased ;
12
12
use crate :: data:: Limits ;
13
- use crate :: trace:: Traceable ;
13
+ use crate :: trace:: { Trace , TraceFormat } ;
14
14
15
15
/// Rocket server configuration.
16
16
///
@@ -26,9 +26,10 @@ use crate::trace::Traceable;
26
26
/// the debug profile while [`Config::release_default()`] the default values for
27
27
/// the release profile. The [`Config::default()`] method automatically selects
28
28
/// the appropriate of the two based on the selected profile. With the exception
29
- /// of `log_level`, which is `normal` in `debug` and `critical` in `release`,
30
- /// and `secret_key`, which is regenerated from a random value if not set in
31
- /// "debug" mode only, all default values are identical in all profiles.
29
+ /// of `log_level` and `log_format`, which are `info` / `pretty` in `debug` and
30
+ /// `error` / `compact` in `release`, and `secret_key`, which is regenerated
31
+ /// from a random value if not set in "debug" mode only, all default values are
32
+ /// identical in all profiles.
32
33
///
33
34
/// # Provider Details
34
35
///
@@ -124,6 +125,8 @@ pub struct Config {
124
125
/// Max level to log. **(default: _debug_ `info` / _release_ `error`)**
125
126
#[ serde( with = "crate::trace::level" ) ]
126
127
pub log_level : Option < Level > ,
128
+ /// Format to use when logging. **(default: _debug_ `pretty` / _release_ `compact`)**
129
+ pub log_format : TraceFormat ,
127
130
/// Whether to use colors and emoji when logging. **(default:
128
131
/// [`CliColors::Auto`])**
129
132
pub cli_colors : CliColors ,
@@ -193,6 +196,7 @@ impl Config {
193
196
secret_key : SecretKey :: zero ( ) ,
194
197
shutdown : ShutdownConfig :: default ( ) ,
195
198
log_level : Some ( Level :: INFO ) ,
199
+ log_format : TraceFormat :: Pretty ,
196
200
cli_colors : CliColors :: Auto ,
197
201
__non_exhaustive : ( ) ,
198
202
}
@@ -217,6 +221,7 @@ impl Config {
217
221
Config {
218
222
profile : Self :: RELEASE_PROFILE ,
219
223
log_level : Some ( Level :: ERROR ) ,
224
+ log_format : TraceFormat :: Compact ,
220
225
..Config :: debug_default ( )
221
226
}
222
227
}
@@ -354,6 +359,9 @@ impl Config {
354
359
/// The stringy parameter name for setting/extracting [`Config::log_level`].
355
360
pub const LOG_LEVEL : & ' static str = "log_level" ;
356
361
362
+ /// The stringy parameter name for setting/extracting [`Config::log_format`].
363
+ pub const LOG_FORMAT : & ' static str = "log_format" ;
364
+
357
365
/// The stringy parameter name for setting/extracting [`Config::shutdown`].
358
366
pub const SHUTDOWN : & ' static str = "shutdown" ;
359
367
@@ -364,8 +372,8 @@ impl Config {
364
372
pub const PARAMETERS : & ' static [ & ' static str ] = & [
365
373
Self :: WORKERS , Self :: MAX_BLOCKING , Self :: KEEP_ALIVE , Self :: IDENT ,
366
374
Self :: IP_HEADER , Self :: PROXY_PROTO_HEADER , Self :: LIMITS ,
367
- Self :: SECRET_KEY , Self :: TEMP_DIR , Self :: LOG_LEVEL , Self :: SHUTDOWN ,
368
- Self :: CLI_COLORS ,
375
+ Self :: SECRET_KEY , Self :: TEMP_DIR , Self :: LOG_LEVEL , Self :: LOG_FORMAT ,
376
+ Self :: SHUTDOWN , Self :: CLI_COLORS ,
369
377
] ;
370
378
371
379
/// The stringy parameter name for setting/extracting [`Config::profile`].
0 commit comments