Skip to content

Commit

Permalink
refactor(telemetry-utlis): Make MockLogger internal (microsoft#23473)
Browse files Browse the repository at this point in the history
## Description

Removes the `MockLogger` class from the `@alpha+@legacy` API surface. It
has been deprecated for external use since 2024-06-18.

Note: originally merged in
microsoft#23010 and reverted in
microsoft#23035 because it hadn't
been announced previously as part of the breaking changes in 2.10.

## Breaking Changes

- `MockLogger` is now removed from the `@alpha+@legacy` API surface,
becoming only `@internal`.
  • Loading branch information
alexvy86 authored Jan 7, 2025
1 parent fb37aa6 commit 237f042
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 40 deletions.
13 changes: 13 additions & 0 deletions .changeset/green-readers-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@fluidframework/telemetry-utils": minor
---
---
"section": legacy
---

MockLogger has been removed from the alpha+legacy API surface

The `MockLogger` class previously exposed in the alpha+legacy API surface of `@fluidframework/telemetry-utils` has
been removed.
No replacement is provided, as this class was only intended for use in testing scenarios, and should be trivial to
re-implement in any codebase that still uses it.
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,6 @@ 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: 1 addition & 22 deletions packages/utils/telemetry-utils/src/mockLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,7 @@ 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.
*
* @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
* @internal
*/
export class MockLogger implements ITelemetryBaseLogger {
/**
Expand Down

0 comments on commit 237f042

Please sign in to comment.