Use tracing logs

Works in linux, not android
This commit is contained in:
Greg Shuflin 2024-10-02 20:55:05 -07:00
parent 178f24c2da
commit 5e1c9c47c3
4 changed files with 17 additions and 1 deletions

13
src-tauri/Cargo.lock generated
View File

@ -1050,6 +1050,7 @@ dependencies = [
"tauri-plugin-os", "tauri-plugin-os",
"tauri-plugin-shell", "tauri-plugin-shell",
"tracing", "tracing",
"tracing-appender",
"tracing-subscriber", "tracing-subscriber",
] ]
@ -3835,6 +3836,18 @@ dependencies = [
"tracing-core", "tracing-core",
] ]
[[package]]
name = "tracing-appender"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf"
dependencies = [
"crossbeam-channel",
"thiserror",
"time",
"tracing-subscriber",
]
[[package]] [[package]]
name = "tracing-attributes" name = "tracing-attributes"
version = "0.1.27" version = "0.1.27"

View File

@ -26,4 +26,5 @@ tauri-plugin-os = "2"
tracing = "0.1.40" tracing = "0.1.40"
tracing-subscriber = "0.3.18" tracing-subscriber = "0.3.18"
tauri-plugin-http = "2" tauri-plugin-http = "2"
tracing-appender = "0.2.3"

View File

@ -6,13 +6,14 @@ fn greet(name: &str) -> String {
#[tauri::command] #[tauri::command]
fn os_info() -> String { fn os_info() -> String {
println!("MAKING A REQUEST"); tracing::info!("Making an OS info request");
let platform = tauri_plugin_os::platform(); let platform = tauri_plugin_os::platform();
format!("Platform Info: {}", platform) format!("Platform Info: {}", platform)
} }
#[cfg_attr(mobile, tauri::mobile_entry_point)] #[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() { pub fn run() {
tracing::info!("Starting up tauri app");
tauri::Builder::default() tauri::Builder::default()
.plugin(tauri_plugin_http::init()) .plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_os::init())

View File

@ -2,5 +2,6 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() { fn main() {
tracing_subscriber::fmt::init();
gensoukyou_tauri_lib::run() gensoukyou_tauri_lib::run()
} }