diff --git a/packages/logs/src/boot/logs.entry.ts b/packages/logs/src/boot/logs.entry.ts index 0bd114342e..f615ea12c2 100644 --- a/packages/logs/src/boot/logs.entry.ts +++ b/packages/logs/src/boot/logs.entry.ts @@ -12,12 +12,12 @@ import { UserConfiguration, } from '@datadog/browser-core' import { HandlerType, Logger, LogsMessage, StatusType } from '../domain/logger' -import { LogsEventsFormat } from '../logsEventsFormat' +import { LogsEvent } from '../logsEvent.types' import { startLogs } from './logs' export interface LogsUserConfiguration extends UserConfiguration { forwardErrorsToLogs?: boolean - beforeSend?: (event: LogsEventsFormat) => void + beforeSend?: (event: LogsEvent) => void } export interface LoggerConfiguration { diff --git a/packages/logs/src/boot/logs.spec.ts b/packages/logs/src/boot/logs.spec.ts index 49a6166dec..b823e26130 100644 --- a/packages/logs/src/boot/logs.spec.ts +++ b/packages/logs/src/boot/logs.spec.ts @@ -11,7 +11,7 @@ import { import sinon from 'sinon' import { Logger, LogsMessage, StatusType } from '../domain/logger' -import { LogsEventsFormat } from '../logsEventsFormat' +import { LogsEvent } from '../logsEvent.types' import { buildAssemble, doStartLogs } from './logs' interface SentMessage extends LogsMessage { @@ -129,13 +129,13 @@ describe('logs', () => { describe('assemble', () => { let assemble: (message: LogsMessage, currentContext: Context) => Context | undefined - let beforeSend: (event: LogsEventsFormat) => void + let beforeSend: (event: LogsEvent) => void beforeEach(() => { beforeSend = noop assemble = buildAssemble(session, { ...(baseConfiguration as Configuration), - beforeSend: (x: LogsEventsFormat) => beforeSend(x), + beforeSend: (x: LogsEvent) => beforeSend(x), }) window.DD_RUM = { getInternalContext: noop, @@ -188,7 +188,7 @@ describe('logs', () => { }) it('should allow modification on sensitive field', () => { - beforeSend = (event: LogsEventsFormat) => (event.message = 'modified') + beforeSend = (event: LogsEvent) => (event.message = 'modified') const assembledMessage = assemble(DEFAULT_MESSAGE, {}) @@ -196,7 +196,7 @@ describe('logs', () => { }) it('should reject modification on non sensitive field', () => { - beforeSend = (event: LogsEventsFormat) => ((event.service as any) = 'modified') + beforeSend = (event: LogsEvent) => ((event.service as any) = 'modified') const assembledMessage = assemble(DEFAULT_MESSAGE, {}) diff --git a/packages/logs/src/boot/logs.ts b/packages/logs/src/boot/logs.ts index 83007b9af4..2ccc8f8d79 100644 --- a/packages/logs/src/boot/logs.ts +++ b/packages/logs/src/boot/logs.ts @@ -16,7 +16,7 @@ import { } from '@datadog/browser-core' import { Logger, LogsMessage } from '../domain/logger' import { LoggerSession, startLoggerSession } from '../domain/loggerSession' -import { LogsEventsFormat } from '../logsEventsFormat' +import { LogsEvent } from '../logsEvent.types' import { buildEnv } from './buildEnv' import { LogsUserConfiguration } from './logs.entry' @@ -126,7 +126,7 @@ export function buildAssemble(session: LoggerSession, configuration: Configurati ) if (configuration.beforeSend) { limitModification( - contextualizedMessage as LogsEventsFormat & Context, + contextualizedMessage as LogsEvent & Context, FIELDS_WITH_SENSITIVE_DATA, configuration.beforeSend ) diff --git a/packages/logs/src/index.ts b/packages/logs/src/index.ts index 001da91b7c..45b04272ba 100644 --- a/packages/logs/src/index.ts +++ b/packages/logs/src/index.ts @@ -1,4 +1,4 @@ export { Datacenter } from '@datadog/browser-core' export { StatusType, HandlerType, Logger, LogsMessage } from './domain/logger' export { LogsUserConfiguration, Status, LoggerConfiguration, LogsGlobal, datadogLogs } from './boot/logs.entry' -export { LogsEventsFormat } from './logsEventsFormat' +export { LogsEvent } from './logsEvent.types' diff --git a/packages/logs/src/logsEventsFormat.ts b/packages/logs/src/logsEvent.types.ts similarity index 97% rename from packages/logs/src/logsEventsFormat.ts rename to packages/logs/src/logsEvent.types.ts index b3dc9a8efe..34fdf7c6be 100644 --- a/packages/logs/src/logsEventsFormat.ts +++ b/packages/logs/src/logsEvent.types.ts @@ -1,4 +1,4 @@ -export interface LogsEventsFormat { +export interface LogsEvent { /** * Start of the log in ms from epoch */ diff --git a/test/e2e/lib/framework/eventsRegistry.ts b/test/e2e/lib/framework/eventsRegistry.ts index dfef2a28a1..f23629f37d 100644 --- a/test/e2e/lib/framework/eventsRegistry.ts +++ b/test/e2e/lib/framework/eventsRegistry.ts @@ -1,4 +1,4 @@ -import { LogsEventsFormat } from '@datadog/browser-logs' +import { LogsEvent } from '@datadog/browser-logs' import { RumEventsFormat } from '@datadog/browser-rum' import { isRumErrorEvent, @@ -12,7 +12,7 @@ type IntakeType = 'logs' | 'rum' | 'internalMonitoring' export class EventRegistry { readonly rum: RumEventsFormat[] = [] - readonly logs: LogsEventsFormat[] = [] + readonly logs: LogsEvent[] = [] readonly internalMonitoring: ServerInternalMonitoringMessage[] = [] push(type: IntakeType, event: any) { diff --git a/test/e2e/scenario/logs.scenario.ts b/test/e2e/scenario/logs.scenario.ts index b2cbf78065..90f4ec977b 100644 --- a/test/e2e/scenario/logs.scenario.ts +++ b/test/e2e/scenario/logs.scenario.ts @@ -1,4 +1,3 @@ -import { LogsEventsFormat } from '@datadog/browser-logs' import { createTest } from '../lib/framework' import { browserExecute, browserExecuteAsync, flushBrowserLogs, withBrowserLogs } from '../lib/helpers/browser' import { flushEvents } from '../lib/helpers/sdk'