Skip to content

Commit

Permalink
Revert "refactor(telemetry-utlis): Make MockLogger internal" (microso…
Browse files Browse the repository at this point in the history
…ft#23035)

Reverts microsoft#23010.

Since it wasn't part of the list of removals for 2.10, holding this
until 2.20.
  • Loading branch information
alexvy86 authored Nov 11, 2024
1 parent 5405422 commit 25913c7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
13 changes: 0 additions & 13 deletions .changeset/green-readers-burn.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt
// @alpha
export type ITelemetryPropertiesExt = Record<string, TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>>;

// @alpha @deprecated
export class MockLogger implements ITelemetryBaseLogger {
constructor(minLogLevel?: LogLevel);
assertMatch(expectedEvents: Omit<ITelemetryBaseEvent, "category">[], message?: string, inlineDetailsProp?: boolean, clearEventsAfterCheck?: boolean): void;
assertMatchAny(expectedEvents: Omit<ITelemetryBaseEvent, "category">[], message?: string, inlineDetailsProp?: boolean, clearEventsAfterCheck?: boolean): void;
assertMatchNone(disallowedEvents: Omit<ITelemetryBaseEvent, "category">[], message?: string, inlineDetailsProp?: boolean, clearEventsAfterCheck?: boolean): void;
assertMatchStrict(expectedEvents: Omit<ITelemetryBaseEvent, "category">[], message?: string, inlineDetailsProp?: boolean, clearEventsAfterCheck?: boolean): void;
clear(): void;
get events(): readonly ITelemetryBaseEvent[];
matchAnyEvent(expectedEvents: Omit<ITelemetryBaseEvent, "category">[], inlineDetailsProp?: boolean, clearEventsAfterCheck?: boolean): boolean;
matchEvents(expectedEvents: Omit<ITelemetryBaseEvent, "category">[], inlineDetailsProp?: boolean, clearEventsAfterCheck?: boolean): boolean;
matchEventStrict(expectedEvents: Omit<ITelemetryBaseEvent, "category">[], inlineDetailsProp?: boolean, clearEventsAfterCheck?: boolean): boolean;
readonly minLogLevel: LogLevel;
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
// (undocumented)
toTelemetryLogger(): ITelemetryLoggerExt;
}

// @alpha
export type TelemetryEventCategory = "generic" | "error" | "performance";

Expand Down
23 changes: 22 additions & 1 deletion packages/utils/telemetry-utils/src/mockLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,28 @@ import type {
* Records events sent to it, and then can walk back over those events, searching for a set of expected events to
* match against the logged events.
*
* @internal
* @deprecated
*
* This class is not intended for use outside of the `fluid-framework` repo, and will be removed from
* package exports in the near future.
*
* Please migrate usages by either creating your own mock {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
* implementation, or by copying this code as-is into your own repo.
*
* @privateRemarks TODO: When we are ready, this type should be made `internal`, and the deprecation notice should be removed.
*
* @deprecated
*
* This class is not intended for use outside of the `fluid-framework` repo, and will be removed from
* package exports in the near future.
*
* Please migrate usages by either creating your own mock {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}
* implementation, or by copying this code as-is into your own repo.
*
* @privateRemarks TODO: When we are ready, this type should be made `internal`, and the deprecation notice should be removed.
*
* @legacy
* @alpha
*/
export class MockLogger implements ITelemetryBaseLogger {
/**
Expand Down

0 comments on commit 25913c7

Please sign in to comment.