Skip to content

Commit

Permalink
Merge pull request #705 from valory-xyz/feat/agent-prev-logs
Browse files Browse the repository at this point in the history
Added prev_log.txt agent logs to export
  • Loading branch information
Tanya-atatakai authored Jan 24, 2025
2 parents e35a6ba + 2b1122c commit 0350e7c
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,23 +789,41 @@ ipcMain.handle('save-logs', async (_, data) => {

// Agent logs
try {
fs.readdirSync(paths.servicesDir).map((serviceDirName) => {
fs.readdirSync(paths.servicesDir).forEach((serviceDirName) => {
const servicePath = path.join(paths.servicesDir, serviceDirName);
if (!fs.existsSync(servicePath)) return;
if (!fs.statSync(servicePath).isDirectory()) return;

const agentLogFilePath = path.join(
servicePath,
'deployment',
'agent',
'log.txt',
);
if (!fs.existsSync(agentLogFilePath)) return;
// Most recent log
try {
const agentLogFilePath = path.join(
servicePath,
'deployment',
'agent',
'log.txt',
);
if (fs.existsSync(agentLogFilePath)) {
sanitizeLogs({
name: `${serviceDirName}_agent.log`,
filePath: agentLogFilePath,
});
}
} catch (e) {
logger.electron(e);
}

return sanitizeLogs({
name: `${serviceDirName}_agent.log`,
filePath: agentLogFilePath,
});
// Previous log
try {
const prevAgentLogFilePath = path.join(servicePath, 'prev_log.txt');
if (fs.existsSync(prevAgentLogFilePath)) {
sanitizeLogs({
name: `${serviceDirName}_prev_agent.log`,
filePath: prevAgentLogFilePath,
});
}
} catch (e) {
logger.electron(e);
}
});
} catch (e) {
logger.electron(e);
Expand Down

0 comments on commit 0350e7c

Please sign in to comment.