Skip to content

Commit

Permalink
chore(logs): improve logs for iplan
Browse files Browse the repository at this point in the history
  • Loading branch information
yossi-eynav committed Apr 17, 2024
1 parent 8e4fb3a commit d7e2464
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 7 additions & 6 deletions server/api/lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ const logger = winston.createLogger({
text = util.format(text, info[Symbol.for('splat')]);
}

try {
const payload = JSON.parse(text)
payload.stackTrace = new Error("stack").stack;
text = JSON.stringify(payload)
} catch(e) {}
if (info.level === 'error') {
try {
const payload = JSON.parse(text)
payload.stackTrace = new Error("stack").stack;
text = JSON.stringify(payload)
} catch(e) {}
}


return {
applicationName: "meirim",
subsystemName: serviceName,
Expand Down
3 changes: 1 addition & 2 deletions server/api/lib/mavat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ const fetchPlanData = (planUrl) =>
resolve({ data: JSON.parse(jsonContent) });

} catch (e) {
Log.error('Mavat fetch error with proxy', e.message);
Log.error(e);
Log.error({ message: 'Mavat fetch error with proxy', error: e });
reject(e);
}
}
Expand Down

0 comments on commit d7e2464

Please sign in to comment.