Skip to content

Commit 463618a

Browse files
committed
add normalization
1 parent 81b9a93 commit 463618a

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.
@@ -223,7 +224,7 @@ export function createConsolaReporter(options: ConsolaReporterOptions = {}): Con
223224

224225
// Build attributes: `rest` properties from logObj get a "consola" prefix; base attributes added below may override
225226
for (const [key, value] of Object.entries(rest)) {
226-
attributes[`consola.${key}`] = value;
227+
attributes[`consola.${key}`] = normalize(value, normalizeDepth, normalizeMaxBreadth);
227228
}
228229

229230
// Build attributes

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('createConsolaReporter', () => {
319319
userId: 123,
320320
action: 'login',
321321
time: '2026-02-24T10:24:04.477Z',
322-
smallObj: { word: 'hi' },
322+
smallObj: { firstLevel: { secondLevel: { thirdLevel: { fourthLevel: 'deep' } } } },
323323
tag: '',
324324
});
325325

@@ -331,7 +331,7 @@ describe('createConsolaReporter', () => {
331331
'consola.type': 'log',
332332
'consola.level': 2,
333333
'consola.userId': 123,
334-
'consola.smallObj': { word: 'hi' },
334+
'consola.smallObj': { firstLevel: { secondLevel: { thirdLevel: '[Object]' } } }, // Object is normalized
335335
'consola.action': 'login',
336336
'consola.time': '2026-02-24T10:24:04.477Z',
337337
'sentry.origin': 'auto.log.consola',

0 commit comments

Comments
 (0)