Skip to content

Commit

Permalink
fix(mockotlpserver): fix logs-summary crash on a LogRecord with no at…
Browse files Browse the repository at this point in the history
…tributes

The normalized LogRecord, for better or worse, elides the 'attributes'
property if there are no attributes.
  • Loading branch information
trentm committed May 2, 2024
1 parent c8eba31 commit baea922
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/mockotlpserver/lib/logs-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit baea922

Please sign in to comment.