Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(telemetry-utlis): Make MockLogger internal #23010

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/green-readers-burn.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, where does the filename green-readers-burn.md come from? Is it randomly generated and these release notes all just get aggregated at release time? Or does the name have some meaning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Randomly generated. Running pnpm changeset from the root of the repo starts a wizard that takes care of that, and just prompts for the package(s) with changes, the "category" of change (like "legacy" in this case; technically free-form, but the ones we use are configured here and a value outside that list will cause the release note generation process to complain), a title, and a longer description. You could copy-paste an existing changeset file and give it any name, it doesn't matter in the end as long as they're unique.

Then we have a flub generate releaseNotes (src) command that takes the changesets and produces the compiled release notes. It runs continuously to produce a preview of the upcoming release notes here (always in that issue).

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 @@ -23,28 +23,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
Loading