Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
albertotirla committed May 29, 2024
1 parent 4c35c53 commit e75cbe4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
9 changes: 4 additions & 5 deletions common/src/settings/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ pub struct LogSettings {
impl Default for LogSettings {
fn default() -> Self {
let directories=xdg::BaseDirectories::with_prefix("odilia").expect("can't create required directories according to the xdg directory specification");
let log_path = directories.place_state_file("odilia.log").expect("can't place log file");
Self {
level: "info".to_owned(),
logger: LoggingKind::File(log_path),
}
let log_path = directories
.place_state_file("odilia.log")
.expect("can't place log file");
Self { level: "info".to_owned(), logger: LoggingKind::File(log_path) }
}
}

Expand Down
18 changes: 9 additions & 9 deletions odilia/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ pub fn init(config: &ApplicationConfig) -> eyre::Result<()> {
_ => EnvFilter::from(&config.log.level),
};
let tree = HierarchicalLayer::new(4)
.with_bracketed_fields(true)
.with_targets(true)
.with_deferred_spans(true)
.with_span_retrace(true)
.with_indent_lines(true)
.with_ansi(false)
.with_wraparound(4);
//this requires boxing because the types returned by this match block would be incompatible otherwise, since we return different layers, or modifications to a layer depending on what we get from the configuration. It is possible to do it otherwise, hopefully, but for now this would do
let final_layer = match &config.log.logger {
.with_bracketed_fields(true)
.with_targets(true)
.with_deferred_spans(true)
.with_span_retrace(true)
.with_indent_lines(true)
.with_ansi(false)
.with_wraparound(4);
//this requires boxing because the types returned by this match block would be incompatible otherwise, since we return different layers, or modifications to a layer depending on what we get from the configuration. It is possible to do it otherwise, hopefully, but for now this would do
let final_layer = match &config.log.logger {
LoggingKind::File(path) => {
let file = std::fs::File::create(path).with_context(|| {
format!("creating log file '{}'", path.display())
Expand Down

0 comments on commit e75cbe4

Please sign in to comment.