mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-11 23:04:40 +02:00
add additional logging to controller and mutations
This commit is contained in:
@@ -2,6 +2,8 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import isElectron from 'is-electron';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { LogCategory, logFn } from '/@/renderer/utils/logger';
|
||||
|
||||
const CHECK_FOR_UPDATES_INTERVAL_MS = 6 * 60 * 60 * 1000;
|
||||
|
||||
const utils = isElectron() ? window.api?.utils : null;
|
||||
@@ -21,7 +23,17 @@ export const useCheckForUpdates = () => {
|
||||
|
||||
return useQuery({
|
||||
enabled: isEnabled,
|
||||
queryFn: () => utils?.checkForUpdates?.(),
|
||||
queryFn: async () => {
|
||||
const result = await utils?.checkForUpdates?.();
|
||||
logFn.info('Check for updates completed', {
|
||||
category: LogCategory.SYSTEM,
|
||||
meta: {
|
||||
updateAvailable: result?.updateAvailable ?? false,
|
||||
version: result?.version,
|
||||
},
|
||||
});
|
||||
return result;
|
||||
},
|
||||
queryKey: ['app-check-for-updates'],
|
||||
refetchInterval: CHECK_FOR_UPDATES_INTERVAL_MS,
|
||||
refetchIntervalInBackground: true,
|
||||
|
||||
@@ -345,7 +345,16 @@ export const useServerAuthenticated = () => {
|
||||
|
||||
const debouncedAuth = debounce(
|
||||
(serverWithAuth: NonNullable<ReturnType<typeof getServerById>>) => {
|
||||
authenticateServer(serverWithAuth).catch(console.error);
|
||||
authenticateServer(serverWithAuth).catch((err) => {
|
||||
logFn.error('Server authentication failed (debounced)', {
|
||||
category: LogCategory.SYSTEM,
|
||||
meta: {
|
||||
message: (err as Error)?.message,
|
||||
serverId: serverWithAuth.id,
|
||||
serverName: serverWithAuth.name,
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
300,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user