Add CLI flag to specify the format of logs written to the logfile (#3839)

## Proposed Changes

Decouple the stdout and logfile formats by adding the `--logfile-format` CLI flag.
This behaves identically to the existing `--log-format` flag, but instead will only affect the logs written to the logfile.
The `--log-format` flag will no longer have any effect on the contents of the logfile.

## Additional Info
This avoids being a breaking change by causing `logfile-format` to default to the value of `--log-format` if it is not provided. 
This means that users who were previously relying on being able to use a JSON formatted logfile will be able to continue to use `--log-format JSON`. 

Users who want to use JSON on stdout and default logs in the logfile, will need to pass the following flags: `--log-format JSON --logfile-format DEFAULT`
This commit is contained in:
Mac L
2023-01-16 03:42:10 +00:00
committed by realbigsean
parent bd7bd005ee
commit 47ade13ef7
7 changed files with 40 additions and 2 deletions

View File

@@ -62,6 +62,7 @@ pub fn run_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
debug_level: String::from("debug"),
logfile_debug_level: String::from("debug"),
log_format: None,
logfile_format: None,
log_color: false,
disable_log_timestamp: false,
max_log_size: 0,

View File

@@ -47,6 +47,7 @@ pub fn run_no_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
debug_level: String::from("debug"),
logfile_debug_level: String::from("debug"),
log_format: None,
logfile_format: None,
log_color: false,
disable_log_timestamp: false,
max_log_size: 0,

View File

@@ -51,6 +51,7 @@ fn syncing_sim(
debug_level: String::from(log_level),
logfile_debug_level: String::from("debug"),
log_format: log_format.map(String::from),
logfile_format: None,
log_color: false,
disable_log_timestamp: false,
max_log_size: 0,