Merge pull request #213 from getmaxun/log

feat: improve logging
This commit is contained in:
Karishma Shukla
2024-11-29 22:23:51 +05:30
committed by GitHub
4 changed files with 13 additions and 13 deletions

View File

@@ -621,7 +621,7 @@ async function executeRun(id: string) {
};
} catch (error: any) {
logger.log('info', `Error while running a recording with id: ${id} - ${error.message}`);
logger.log('info', `Error while running a robot with id: ${id} - ${error.message}`);
const run = await Run.findOne({ where: { runId: id } });
if (run) {
await run.update({
@@ -660,7 +660,7 @@ export async function handleRunRecording(id: string, userId: string) {
socket.on('ready-for-run', () => readyForRunHandler(browserId, newRunId));
logger.log('info', `Running recording: ${id}`);
logger.log('info', `Running Robot: ${id}`);
socket.on('disconnect', () => {
cleanupSocketListeners(socket, browserId, newRunId);
@@ -670,7 +670,7 @@ export async function handleRunRecording(id: string, userId: string) {
return newRunId;
} catch (error: any) {
logger.error('Error running recording:', error);
logger.error('Error running robot:', error);
}
}

View File

@@ -243,8 +243,8 @@ export class RemoteBrowser {
return;
}
await this.client.send('Page.screencastFrameAck', { sessionId: sessionId });
} catch (e) {
logger.log('error', e);
} catch (e: any) {
logger.log('error', `Screencast error: ${e}`);
}
}, 100);
});
@@ -278,7 +278,7 @@ export class RemoteBrowser {
}
} catch (e) {
const { message } = e as Error;
logger.log('error', message);
logger.log('error', `Screenshot error: ${message}`);
}
};

View File

@@ -38,7 +38,7 @@ router.get('/recordings', requireSignIn, async (req, res) => {
const data = await Robot.findAll();
return res.send(data);
} catch (e) {
logger.log('info', 'Error while reading recordings');
logger.log('info', 'Error while reading robots');
return res.send(null);
}
});
@@ -55,7 +55,7 @@ router.get('/recordings/:id', requireSignIn, async (req, res) => {
);
return res.send(data);
} catch (e) {
logger.log('info', 'Error while reading recordings');
logger.log('info', 'Error while reading robots');
return res.send(null);
}
})
@@ -400,7 +400,7 @@ router.put('/runs/:id', requireSignIn, async (req: AuthenticatedRequest, res) =>
});
} catch (e) {
const { message } = e as Error;
logger.log('info', `Error while creating a run with recording id: ${req.params.id} - ${message}`);
logger.log('info', `Error while creating a run with robot id: ${req.params.id} - ${message}`);
return res.send('');
}
});
@@ -518,7 +518,7 @@ router.post('/runs/run/:id', requireSignIn, async (req: AuthenticatedRequest, re
finishedAt: new Date().toLocaleString(),
});
}
logger.log('info', `Error while running a recording with id: ${req.params.id} - ${message}`);
logger.log('info', `Error while running a robot with id: ${req.params.id} - ${message}`);
capture(
'maxun-oss-run-created-manual',
{
@@ -757,7 +757,7 @@ router.post('/runs/abort/:id', requireSignIn, async (req, res) => {
return res.send(true);
} catch (e) {
const { message } = e as Error;
logger.log('info', `Error while running a recording with name: ${req.params.fileName}_${req.params.runId}.json`);
logger.log('info', `Error while running a robot with name: ${req.params.fileName}_${req.params.runId}.json`);
return res.send(false);
}
});

View File

@@ -171,7 +171,7 @@ async function executeRun(id: string) {
processGoogleSheetUpdates();
return true;
} catch (error: any) {
logger.log('info', `Error while running a recording with id: ${id} - ${error.message}`);
logger.log('info', `Error while running a robot with id: ${id} - ${error.message}`);
console.log(error.message);
const run = await Run.findOne({ where: { runId: id } });
if (run) {
@@ -232,7 +232,7 @@ export async function handleRunRecording(id: string, userId: string) {
socket.on('ready-for-run', () => readyForRunHandler(browserId, newRunId));
logger.log('info', `Running recording: ${id}`);
logger.log('info', `Running robot: ${id}`);
socket.on('disconnect', () => {
cleanupSocketListeners(socket, browserId, newRunId);