Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
thewh1teagle committed Nov 20, 2023
1 parent 509301a commit bd57184
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
41 changes: 41 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,16 @@ npm run dev -- --host 0.0.0.0

### Building
To build for the current platform, execute `cargo tauri build`. On Windows, this will build both NSIS and MSI installers. Both function identically and are located under `src-tauri/target/release/bundle/<msi or nsis>`.


### Debugging
When developing you can see logging messages by setting ENV variable
```
export RUST_LOG=trace
cargo tauri dev
```

For forther exploring, you can even try setting
```
RUST_BACKTRACE=1
```
1 change: 1 addition & 0 deletions desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tauri-build = { version = "1.4", features = [] }
tauri = { version = "1.4", features = ["shell-open", "devtools"] }
enigo = { version = "0.2.0-rc2" }
env_logger = "0.10"
log = "0.4.20"


[target.'cfg(any(windows, target_os = "macos"))'.dependencies]
Expand Down
3 changes: 2 additions & 1 deletion desktop/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
use window_shadows::set_shadow;

use enigo::{Direction, Enigo, Key, Keyboard, Settings};
use log::debug;
use tauri::Manager;

#[tauri::command]
async fn press(key: String) -> Result<(), String> {
let mut enigo = Enigo::new(&Settings::default()).unwrap();

debug!("Pressing {}", key);
match key.as_str() {
"VOL_UP" => {
enigo.key(Key::VolumeUp, Direction::Click).unwrap();
Expand Down

0 comments on commit bd57184

Please sign in to comment.