diff --git a/server/api/lib/log.js b/server/api/lib/log.js index 18598b17..d07851fc 100644 --- a/server/api/lib/log.js +++ b/server/api/lib/log.js @@ -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, diff --git a/server/api/lib/mavat/index.js b/server/api/lib/mavat/index.js index 5a0cff01..9eb69cc3 100644 --- a/server/api/lib/mavat/index.js +++ b/server/api/lib/mavat/index.js @@ -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); } }