Clean up debug logging spam

- Remove ~101 useless debug print statements from production code
- Remove verbose resource debugging and repetitive status messages
- Significantly reduce console noise while maintaining error visibility
This commit is contained in:
2025-05-30 22:59:25 -05:00
parent a9976cbbe5
commit 4f71789710
5 changed files with 11 additions and 183 deletions
-18
View File
@@ -26,21 +26,16 @@ function App() {
// Function to minimize app to tray
const minimizeToTray = useCallback(async () => {
try {
console.log('Minimizing app to tray');
// First hide the window to ensure it disappears immediately
await appWindow.hide();
console.log('Window hidden, now ensuring tray is visible');
// Then call the backend to ensure the tray is visible
await invoke("minimize_to_tray");
console.log('minimize_to_tray command completed successfully');
} catch (error) {
console.error("Failed to minimize to tray:", error);
// Fallback to window API if the invoke fails
try {
console.log('Trying fallback hide');
await appWindow.hide();
console.log('Fallback hide succeeded');
} catch (fallbackError) {
console.error("Fallback hide also failed:", fallbackError);
}
@@ -52,7 +47,6 @@ function App() {
const setupFocusHandler = async () => {
const unlistenFocus = await appWindow.onFocusChanged(async ({ payload: focused }) => {
if (focused) {
console.log('Window gained focus, re-applying custom cursor');
try {
await invoke("reapply_custom_cursor");
} catch (error) {
@@ -82,7 +76,6 @@ function App() {
try {
// Get cursors from the Tauri backend
const loadedCursors = await invoke("get_cursors");
console.log("Loaded cursors:", loadedCursors);
setCursors(loadedCursors || []);
// Get current cursor index
@@ -109,16 +102,12 @@ function App() {
useEffect(() => {
const setupCloseHandler = async () => {
const unlisten = await appWindow.onCloseRequested(async (event) => {
console.log('Window close requested');
if (settings.minimizeToTrayOnClose) {
console.log('Minimize to tray setting is enabled, preventing close and hiding instead');
// Prevent the window from closing
event.preventDefault();
// Temporarily restore cursor before hiding to tray
try {
console.log('Temporarily restoring cursor before hiding to tray');
await invoke("temporarily_restore_cursor");
} catch (error) {
console.error('Failed to restore cursor before hiding:', error);
@@ -126,14 +115,11 @@ function App() {
// Hide the window instead
try {
console.log('Calling minimizeToTray function');
await minimizeToTray();
console.log('Window should now be hidden and app should be in system tray');
} catch (error) {
console.error('Failed to minimize to tray on close:', error);
}
} else {
console.log('Minimize to tray setting is disabled, allowing window to close');
// Let the window close normally, but we need to call quit_app to ensure proper cleanup
try {
await invoke("quit_app");
@@ -149,7 +135,6 @@ function App() {
let unlistenFn;
setupCloseHandler().then(unlisten => {
unlistenFn = unlisten;
console.log('Close handler set up successfully');
}).catch(err => console.error('Failed to set up close handler:', err));
// Clean up event listener on unmount
@@ -163,7 +148,6 @@ function App() {
// Functions to handle cursor operations using Tauri backend
const selectCursor = async (index) => {
try {
console.log(`Selecting cursor at index ${index}`);
await invoke("select_cursor", { index });
setCurrentCursorIndex(index);
} catch (error) {
@@ -175,7 +159,6 @@ function App() {
if (cursors.length === 0) return;
try {
console.log('Switching to next cursor');
const newIndex = await invoke("next_cursor");
setCurrentCursorIndex(newIndex);
} catch (error) {
@@ -189,7 +172,6 @@ function App() {
// Function to exit app
const quitApp = async () => {
try {
console.log('Quitting app');
await invoke("quit_app");
} catch (error) {
console.error("Failed to quit app:", error);