mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-22 21:31:10 -05:00
Merge #893
893: Always write logs as JSON to file r=binarybaron a=binarybaron Related issue: https://github.com/comit-network/xmr-btc-swap/issues/849 Co-authored-by: binarybaron <86064887+binarybaron@users.noreply.github.com>
This commit is contained in:
commit
6911509b16
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Revert logs to use rfc3339 local time formatting.
|
- Revert logs to use rfc3339 local time formatting.
|
||||||
|
- Always write logs as JSON to files
|
||||||
|
|
||||||
## [0.10.2] - 2021-12-25
|
## [0.10.2] - 2021-12-25
|
||||||
|
|
||||||
|
@ -20,27 +20,22 @@ pub fn init(debug: bool, json: bool, dir: impl AsRef<Path>, swap_id: Option<Uuid
|
|||||||
|
|
||||||
std::mem::forget(guard);
|
std::mem::forget(guard);
|
||||||
|
|
||||||
let file_logger = fmt::layer()
|
let file_logger = registry.with(
|
||||||
|
fmt::layer()
|
||||||
.with_ansi(false)
|
.with_ansi(false)
|
||||||
.with_target(false)
|
.with_target(false)
|
||||||
.with_writer(appender);
|
.json()
|
||||||
|
.with_writer(appender),
|
||||||
|
);
|
||||||
|
|
||||||
if json && debug {
|
if json && debug {
|
||||||
set_global_default(
|
set_global_default(file_logger.with(debug_json_terminal_printer()))?;
|
||||||
registry
|
|
||||||
.with(file_logger.json())
|
|
||||||
.with(debug_json_terminal_printer()),
|
|
||||||
)?;
|
|
||||||
} else if json && !debug {
|
} else if json && !debug {
|
||||||
set_global_default(
|
set_global_default(file_logger.with(info_json_terminal_printer()))?;
|
||||||
registry
|
|
||||||
.with(file_logger.json())
|
|
||||||
.with(info_json_terminal_printer()),
|
|
||||||
)?;
|
|
||||||
} else if !json && debug {
|
} else if !json && debug {
|
||||||
set_global_default(registry.with(file_logger).with(debug_terminal_printer()))?;
|
set_global_default(file_logger.with(debug_terminal_printer()))?;
|
||||||
} else {
|
} else {
|
||||||
set_global_default(registry.with(file_logger).with(info_terminal_printer()))?;
|
set_global_default(file_logger.with(info_terminal_printer()))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user