From 62eafe22b31c634d0ecc26c6092e1aec1419220d Mon Sep 17 00:00:00 2001 From: Disr0 Date: Tue, 13 Feb 2024 10:47:30 +0700 Subject: [PATCH 1/3] docs: correct formatting tokens in upower --- docs/modules/Upower.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/modules/Upower.md b/docs/modules/Upower.md index 2118662..e5db9aa 100644 --- a/docs/modules/Upower.md +++ b/docs/modules/Upower.md @@ -74,11 +74,11 @@ end: The following tokens can be used in the `format` config option, and will be replaced with values from the current battery state: -| Token | Description | -|----------------|------------------------------------------| -| `{percentage}` | The battery charge percentage. | -| `{state}` | The current battery (dis)charging state. | -| `{remaining}` | The ETA to battery empty or full. | +| Token | Description | +|---------------------|------------------------------------------| +| `{percentage}` | The battery charge percentage. | +| `{state}` | The current battery (dis)charging state. | +| `{time_remaining}` | The ETA to battery empty or full. | ## Styling From f68d95a740c02434866c662d2cd915a0c5253ba5 Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Wed, 14 Feb 2024 21:16:53 +0000 Subject: [PATCH 2/3] fix(logging): log file growing indefinitely Log files are now created on a daily rotation, keeping 3 days worth of logs. This also changes the log file names. Fixes #453 --- src/logging.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/logging.rs b/src/logging.rs index 18d5995..bfa73c0 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -4,6 +4,7 @@ use std::{env, panic}; use strip_ansi_escapes::Writer; use tracing::error; use tracing_appender::non_blocking::{NonBlocking, WorkerGuard}; +use tracing_appender::rolling::Rotation; use tracing_error::ErrorLayer; use tracing_subscriber::fmt::{Layer, MakeWriter}; use tracing_subscriber::prelude::*; @@ -67,7 +68,13 @@ fn install_tracing() -> Result { let log_path = data_dir().unwrap_or(env::current_dir()?).join("ironbar"); - let appender = tracing_appender::rolling::never(log_path, "error.log"); + let appender = tracing_appender::rolling::Builder::new() + .rotation(Rotation::DAILY) + .filename_prefix("ironbar") + .filename_suffix("log") + .max_log_files(3) + .build(log_path)?; + let (file_writer, guard) = tracing_appender::non_blocking(appender); tracing_subscriber::registry() From e26e213c4e409018f3b5c35b0319f5db8c0fa3bb Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Wed, 14 Feb 2024 21:17:03 +0000 Subject: [PATCH 3/3] docs(readme): improve info about logging --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index da23749..08a34d8 100644 --- a/README.md +++ b/README.md @@ -153,11 +153,14 @@ See the [Configuration Guide](https://github.com/JakeStanger/ironbar/wiki/config Ironbar can be launched using the `ironbar` binary. -Log verbosity can be changed using `IRONBAR_LOG` or `IRONBAR_FILE_LOG`. You can use any of `error`, `warn`, `info`, `debug` or `trace`. +The `IRONBAR_LOG` and `IRONBAR_FILE_LOG` environment variables can be set +to change console and file log verbosity respectively. +You can use any of `error`, `warn`, `info`, `debug` or `trace`. -These default to `IRONBAR_LOG=info` and `IRONBAR_FILE_LOG=error`. +These default to `IRONBAR_LOG=info` and `IRONBAR_FILE_LOG=warn`. +Note that you cannot increase the file log verbosity above console verbosity. -File output can be found at `~/.local/share/ironbar/error.log`. +Log files can be found at `~/.local/share/ironbar/.log`. ## Status