pub fn init_terminal_and_file_logging(
file_log_config: &FileLogging,
logs_root: &Path,
) -> Result<WorkerGuard>
Available on crate feature
logging
only.Expand description
Initialize logging both in the terminal and file based.
The terminal based logging layer will:
- use the default
fmt::format::Format
. - log to
std::io::Stderr
The file base logging layer will:
- use the default
fmt::format::Format
save for:- including line numbers.
- not using ansi colors.
- create log files in the
FileLogging::dir
directory. If not provided, thelogs
dir inside the givenlogs_root
is used. - rotate files every
FileLogging::rotation
. - keep at most
FileLogging::max_files
log files. - use the filtering defined by
FileLogging::rust_log
. When not provided, the defaultDEFAULT_FILE_RUST_LOG
is used. - create log files with the name
iroh-<ROTATION_BASED_NAME>.log
(ex: iroh-2024-02-02.log)