Skip to content

Commit d33f039

Browse files
committed
simplify detection of force_debug
1 parent 910d218 commit d33f039

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ You can also send a simple "ping" request using `SIGUSR1`:
105105
kill -SIGUSR1 $(pidof pwmp-server)
106106
```
107107

108+
## Logging
109+
You can force debug logging in release builds by using the `--debug` flag, or by setting the `PWMP_DEBUG` environment variable to `true` (case insensitive). Any other value will be ignored.
110+
In debug builds, debug logging is enabled by default.
111+
108112
## Compiling caveats and portability
109113
In general, *x86* and *aarch64* are well-supported with *Linux*. macOS *should* theoretically work. Windows is **not** supported and there are no plans for it.
110114
Cross-compilation to macOS requires additional setup, due to licensing restrictions.

src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ async fn main() -> Result<(), error::Error> {
1818
let args = cli::Cli::parse();
1919
let config_path = args.config.clone().unwrap_or_else(Config::default_path);
2020
let (config, first_run) = server::config::setup(&config_path)?;
21-
let force_debug = args.debug
22-
|| env::var("PWMP_DEBUG")
23-
.is_ok_and(|value| ["OK", "1", "YES", "true"].contains(&value.to_lowercase().as_str()));
21+
let force_debug =
22+
args.debug || env::var("PWMP_DEBUG").is_ok_and(|value| value.to_lowercase() == "true");
2423

2524
if let Err(why) = logging::setup(force_debug, &config) {
2625
eprintln!("Failed to set up logging: {why}");

0 commit comments

Comments
 (0)