Skip to content

Commit e12b52d

Browse files
committed
Cleanup logging
1 parent eed066e commit e12b52d

2 files changed

Lines changed: 0 additions & 32 deletions

File tree

‎src-tauri/src/macos.rs‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,8 @@
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17-
// Based on https://github.com/FabianLars/tauri-plugin-deep-link
18-
19-
use std::{
20-
fs::OpenOptions,
21-
io::Write,
22-
};
23-
2417
use tauri::{menu::{Menu, MenuItem, PredefinedMenuItem, Submenu}, AppHandle};
2518

26-
// kAEOpenDocuments
27-
const EVENT_OPEN_DOCUMENTS: u32 = 0x6F646F63;
28-
// kAEGetURL
29-
const EVENT_GET_URL: u32 = 0x4755524c;
30-
31-
fn log_event(event_id: u32, payload: &[String]) {
32-
let Some(path) = dirs::home_dir().map(|home| home.join("trgui.log")) else {
33-
return;
34-
};
35-
36-
if let Ok(mut log) = OpenOptions::new().create(true).append(true).open(path) {
37-
let _ = writeln!(log, "event_id={event_id:#010x} payload={payload:?}");
38-
}
39-
}
40-
41-
pub fn log_opened_urls(urls: &[String]) {
42-
let event_id = if urls.first().is_some_and(|url| url.starts_with("file:")) {
43-
EVENT_OPEN_DOCUMENTS
44-
} else {
45-
EVENT_GET_URL
46-
};
47-
log_event(event_id, urls);
48-
}
49-
5019
pub fn make_menu<R>(app: &AppHandle<R>) -> tauri::Result<Menu<R>>
5120
where
5221
R: tauri::Runtime,

‎src-tauri/src/main.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ fn main() {
239239
#[cfg(target_os = "macos")]
240240
tauri::RunEvent::Opened { urls } => {
241241
let urls: Vec<String> = urls.into_iter().map(|url| url.to_string()).collect();
242-
macos::log_opened_urls(&urls);
243242
handle_uris(app_handle, urls);
244243
}
245244
#[cfg(target_os = "macos")]

0 commit comments

Comments
 (0)