mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-12 07:13:34 +03:00
Merge pull request #1638 from gitbutlerapp/add-log-level-environment-variable
Add log level environment variable
This commit is contained in:
commit
7f633e59f5
@ -21,10 +21,10 @@ Now you should be able to run the app in development mode:
|
||||
$ pnpm tauri dev
|
||||
```
|
||||
|
||||
By default it will not print debug logs to console. If you want debug logs, use `debug` feature:
|
||||
By default it will not print debug logs to console. If you want debug logs, set `LOG_LEVEL` environment variable:
|
||||
|
||||
```bash
|
||||
$ pnpm tauri dev --features debug
|
||||
$ LOG_LEVEL=debug pnpm tauri dev
|
||||
```
|
||||
|
||||
### Lint & format
|
||||
|
@ -78,8 +78,6 @@ zip = "0.6.5"
|
||||
# by default Tauri runs in production mode
|
||||
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
|
||||
default = ["custom-protocol"]
|
||||
# enabled debug logging
|
||||
debug = []
|
||||
# this feature enables devtools
|
||||
devtools = ["tauri/devtools"]
|
||||
# this feature is used used for production builds where `devPath` points to the filesystem
|
||||
|
@ -22,11 +22,11 @@ pub fn init(app_handle: &AppHandle) {
|
||||
.with_target(false)
|
||||
.compact();
|
||||
|
||||
let log_level_filter = if cfg!(feature = "debug") {
|
||||
LevelFilter::DEBUG
|
||||
} else {
|
||||
LevelFilter::INFO
|
||||
};
|
||||
let log_level_filter = std::env::var("LOG_LEVEL")
|
||||
.unwrap_or("info".to_string())
|
||||
.to_lowercase()
|
||||
.parse()
|
||||
.unwrap_or(LevelFilter::INFO);
|
||||
|
||||
let subscriber = tracing_subscriber::registry()
|
||||
.with(
|
||||
|
Loading…
Reference in New Issue
Block a user