From baea922adc36c01e0e9a234c925a8611a2dcc7aa Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 2 May 2024 16:38:29 -0700 Subject: [PATCH] fix(mockotlpserver): fix logs-summary crash on a LogRecord with no attributes The normalized LogRecord, for better or worse, elides the 'attributes' property if there are no attributes. --- packages/mockotlpserver/lib/logs-summary.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/mockotlpserver/lib/logs-summary.js b/packages/mockotlpserver/lib/logs-summary.js index bc0978e1..2687cc26 100644 --- a/packages/mockotlpserver/lib/logs-summary.js +++ b/packages/mockotlpserver/lib/logs-summary.js @@ -91,7 +91,10 @@ class LogsSummaryPrinter extends Printer { rec.severityNumber } (${meta}): ${stylizeWithColor(rec.body, 'cyan')}` ); - if (Object.keys(rec.attributes).length > 0) { + if ( + rec.attributes && + Object.keys(rec.attributes).length > 0 + ) { let attrSummary = util .inspect(rec.attributes, { depth: 10,