Skip to content

Commit d906d0d

Browse files
committed
add normalization
1 parent 75774d9 commit d906d0d

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/core/src/integrations/consola.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getClient } from '../currentScopes';
33
import { _INTERNAL_captureLog } from '../logs/internal';
44
import { formatConsoleArgs } from '../logs/utils';
55
import type { LogSeverityLevel } from '../types-hoist/log';
6+
import { normalize } from '../utils/normalize';
67

78
/**
89
* Options for the Sentry Consola reporter.
@@ -230,7 +231,7 @@ export function createConsolaReporter(options: ConsolaReporterOptions = {}): Con
230231

231232
// Build attributes: `rest` properties from logObj get a "consola" prefix; base attributes added below may override
232233
for (const [key, value] of Object.entries(rest)) {
233-
attributes[`consola.${key}`] = value;
234+
attributes[`consola.${key}`] = normalize(value, normalizeDepth, normalizeMaxBreadth);
234235
}
235236

236237
// Build attributes

packages/core/test/lib/integrations/consola.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ describe('createConsolaReporter', () => {
217217
userId: 123,
218218
action: 'login',
219219
time: '2026-02-24T10:24:04.477Z',
220-
smallObj: { word: 'hi' },
220+
smallObj: { firstLevel: { secondLevel: { thirdLevel: { fourthLevel: 'deep' } } } },
221221
tag: '',
222222
});
223223

@@ -229,7 +229,7 @@ describe('createConsolaReporter', () => {
229229
'consola.type': 'log',
230230
'consola.level': 2,
231231
'consola.userId': 123,
232-
'consola.smallObj': { word: 'hi' },
232+
'consola.smallObj': { firstLevel: { secondLevel: { thirdLevel: '[Object]' } } }, // Object is normalized
233233
'consola.action': 'login',
234234
'consola.time': '2026-02-24T10:24:04.477Z',
235235
'sentry.origin': 'auto.log.consola',

0 commit comments

Comments
 (0)