Skip to content

Commit c217516

Browse files
authored
chore: refactor logs (#646)
1 parent 7ca1ef2 commit c217516

File tree

6 files changed

+4
-36
lines changed

6 files changed

+4
-36
lines changed

main/src/graceful-exit.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ export async function stopAllServers(
7777

7878
// Store the servers that are about to be shut down
7979
shutdownStore.set('lastShutdownServers', servers)
80-
log.info(`Stored ${servers.length} servers for shutdown tracking`)
81-
8280
log.info(`Stopping ${servers.length} servers...`)
8381

8482
// First, initiate stop for all servers

main/src/main.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,12 @@ app.on('ready', () => {
6666
return
6767
}
6868

69-
log.info('Simulating a new release for testing purposes')
7069
mainWindow.webContents.send('update-downloaded')
7170
}, 2000)
7271
})
7372

74-
autoUpdater.on('before-quit-for-update', () => {
75-
log.info('🔄 before-quit-for-update event fired')
76-
})
77-
7873
autoUpdater.on('update-downloaded', (_, __, releaseName) => {
7974
log.info('🔄 Update downloaded - showing dialog')
80-
log.info(`📦 Release info: ${releaseName}`)
8175

8276
if (!mainWindow) {
8377
log.error('MainWindow not available for update dialog')
@@ -108,12 +102,8 @@ autoUpdater.on('update-downloaded', (_, __, releaseName) => {
108102
dialog
109103
.showMessageBox(mainWindow, dialogOpts)
110104
.then(async (returnValue) => {
111-
log.info(
112-
`🎯 User clicked: ${returnValue.response === 0 ? 'Restart' : 'Later'}`
113-
)
114-
115105
if (returnValue.response === 0) {
116-
log.info('🎯 User clicked: Restart')
106+
log.debug('User clicked: Restart')
117107
isUpdateInProgress = true
118108

119109
log.info('🛑 Removing quit listeners to avoid interference')
@@ -123,13 +113,10 @@ autoUpdater.on('update-downloaded', (_, __, releaseName) => {
123113
isQuitting = true
124114
tearingDown = true
125115

126-
log.info('🔄 Starting restart process...')
127-
128116
try {
129117
log.info('🛑 Starting graceful shutdown before update...')
130118
mainWindow?.webContents.send('graceful-exit')
131119

132-
log.info('⏳ Waiting for renderer...')
133120
await delay(500)
134121

135122
const port = getToolhivePort()
@@ -152,7 +139,9 @@ autoUpdater.on('update-downloaded', (_, __, releaseName) => {
152139
}
153140
} else {
154141
isUpdateInProgress = false
155-
log.info('⏰ User chose Later - showing toast notification')
142+
log.info(
143+
'User deferred update installation - showing toast notification'
144+
)
156145
if (mainWindow) {
157146
mainWindow.webContents.send('update-downloaded')
158147
}
@@ -239,7 +228,6 @@ if (!gotTheLock) {
239228
} else {
240229
app.on('second-instance', () => {
241230
// Someone tried to run a second instance, focus our window instead
242-
log.info('Second instance attempted, focusing existing window')
243231
if (mainWindow) {
244232
if (mainWindow.isMinimized()) mainWindow.restore()
245233
mainWindow.focus()

main/src/system-tray.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,6 @@ const createClickHandler = () => {
213213

214214
const toggleWindow = (window: BrowserWindow) => {
215215
setTimeout(() => {
216-
log.info('TOGGLE WIN: ', {
217-
winIsVisible: window.isVisible(),
218-
winIsMinimized: window.isMinimized(),
219-
check: window.isVisible() && !window.isMinimized(),
220-
})
221216
showWindowWithFocus(window)
222217
}, 50)
223218
}

main/src/toolhive-manager.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ function findFreePort(): Promise<number> {
5858
}
5959

6060
export async function startToolhive(tray?: Tray): Promise<void> {
61-
log.info(
62-
`[startToolhive] Starting - Current state: isRunning=${isToolhiveRunning()}, isRestarting=${isRestarting}`
63-
)
64-
6561
if (!existsSync(binPath)) {
6662
log.error(`ToolHive binary not found at: ${binPath}`)
6763
return
@@ -135,9 +131,6 @@ export async function restartToolhive(tray?: Tray): Promise<void> {
135131
}
136132

137133
export function stopToolhive(): void {
138-
log.info(
139-
`[stopToolhive] Current state: isRunning=${isToolhiveRunning()}, PID: ${toolhiveProcess?.pid}`
140-
)
141134
if (toolhiveProcess && !toolhiveProcess.killed) {
142135
log.info('Stopping ToolHive process...')
143136
toolhiveProcess.kill()

renderer/src/common/components/error/connection-refused-error.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ export function ConnectionRefusedError() {
6464
})
6565

6666
useEffect(() => {
67-
if (!containerStatus?.available) {
68-
log.info('Container engines are not available')
69-
}
7067
if (containerStatus?.available && !isRestarting) {
7168
restartToolhive()
7269
}

renderer/src/routes/__root.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export const Route = createRootRouteWithContext<{
7878

7979
try {
8080
isUpdateInProgress = await window.electronAPI.isUpdateInProgress()
81-
log.info(`[beforeLoad] Update in progress: ${isUpdateInProgress}`)
8281
} catch (e) {
8382
log.debug(`[beforeLoad] Update check API not available: ${e}`)
8483
}
@@ -92,11 +91,9 @@ export const Route = createRootRouteWithContext<{
9291
queryKey: ['is-toolhive-running'],
9392
queryFn: async () => {
9493
const res = await window.electronAPI.isToolhiveRunning()
95-
const appVersion = await window.electronAPI.getAppVersion()
9694
if (!res) {
9795
log.error('ToolHive is not running')
9896
}
99-
log.info(`ToolHive version ${appVersion} is running`)
10097
return res
10198
},
10299
retry: 3,

0 commit comments

Comments
 (0)