Skip to content

refactor(container-loader): export mixinDebugLogger as a free function - #28058

Merged
MarioJGMsoft merged 1 commit into
microsoft:mainfrom
MarioJGMsoft:marioja/debuglogger-free-function
Aug 24, 2026
Merged

MarioJGMsoft merged 1 commit into
microsoft:mainfrom
MarioJGMsoft:marioja/debuglogger-free-function

Conversation

@MarioJGMsoft

Copy link
Copy Markdown
Contributor

Description

DebugLogger in container-loader is exported only to serve as a namespace for a single static method, mixinDebugLogger. Nothing can actually use the class as a type: it is not re-exported from the package index, appears in no API report, and its constructor is private. The one instance is created inside the mixin and handed to createMultiSinkLogger as an ITelemetryBaseLogger, and the mixin returns a TelemetryLoggerExt.

This exports the mixin directly as a free function and lets the class become module private. The private constructor is no longer needed to prevent construction from outside the module, so it becomes a normal one. The two in-package call sites (loader.ts, createAndLoadContainerUtils.ts) now import mixinDebugLogger instead of DebugLogger.

No public API change, so no API report updates and no changeset.

Suggested by Jason Hartman (@jason-ha) in review feedback on #28044, split out here to keep that PR focused on telemetry plumbing.

Reviewer Guidance

The review process is outlined in the pull request guidelines.

  • The class is declared before the exported function so that no-use-before-define stays satisfied. Happy to flip the order if the export-first convention is preferred.

`DebugLogger` was exported only to serve as a namespace for a single
static method. It is not re-exported from the package index and appears
in no API report, and its private constructor meant no caller could hold
an instance anyway -- `mixinDebugLogger` returns a `TelemetryLoggerExt`
built by `createMultiSinkLogger`.

Export that mixin directly instead and let the class become module
private. The private constructor is no longer needed to prevent outside
construction, so it becomes a normal one.

No public API change.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8a07af10-6ed8-4c13-bd58-176b5110a9d4
@github-actions

Copy link
Copy Markdown
Contributor

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (87 lines, 3 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

@MarioJGMsoft
MarioJGMsoft marked this pull request as ready for review August 24, 2026 16:06
Copilot AI lite review requested due to automatic review settings August 24, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors container-loader to export mixinDebugLogger as a free function while preserving behavior and the public API.

Changes:

  • Makes DebugLogger module-private.
  • Updates both call sites to use mixinDebugLogger.
  • Preserves logger and telemetry behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/loader/container-loader/src/loader.ts Updates the loader call site and import.
packages/loader/container-loader/src/debugLogger.ts Exports the mixin function and privatizes the implementation class.
packages/loader/container-loader/src/createAndLoadContainerUtils.ts Updates the container utility call site and import.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: 0e44043224e1ac08433f71917e4350aa7f3e4047
Head commit: 6058d0c434f37a7308d16013971e2e46eca3fa7a

Notable changes

No bundles changed by ≥ 500 bytes parsed.

Per-bundle deltas

@fluid-example/bundle-size-tests

  • fluidFrameworkAllAlpha.js: parsed 784813 → 784869 (+56), gzip 215706 → 215762 (+56)
  • azureClient.js: parsed 632351 → 632312 (-39), gzip 169408 → 169483 (+75)
  • odspClient.js: parsed 605567 → 605649 (+82), gzip 162931 → 163032 (+101)
  • aqueduct.js: parsed 536725 → 536736 (+11), gzip 144128 → 144169 (+41)
  • fluidFramework.js: parsed 403671 → 403704 (+33), gzip 114672 → 114713 (+41)
  • sharedTree.js: parsed 393050 → 393076 (+26), gzip 112093 → 112118 (+25)
  • containerRuntime.js: parsed 313633 → 313615 (-18), gzip 86019 → 86016 (-3)
  • sharedString.js: parsed 175134 → 175141 (+7), gzip 49635 → 49640 (+5)
  • experimentalSharedTree.js: parsed 161726 → 161726 (0), gzip 46665 → 46665 (0)
  • matrix.js: parsed 159511 → 159520 (+9), gzip 45849 → 45854 (+5)
  • loader.js: parsed 146720 → 146698 (-22), gzip 39875 → 39865 (-10)
  • odspDriver.js: parsed 111318 → 111394 (+76), gzip 34621 → 34698 (+77)
  • directory.js: parsed 65559 → 65566 (+7), gzip 18444 → 18451 (+7)
  • 578.js: parsed 58686 → 58686 (0), gzip 17657 → 17657 (0)
  • odspPrefetchSnapshot.js: parsed 45838 → 45819 (-19), gzip 15321 → 15331 (+10)
  • map.js: parsed 45710 → 45717 (+7), gzip 14077 → 14085 (+8)
  • 252.js: parsed 44362 → 44362 (0), gzip 13735 → 13735 (0)
  • summarizerDelayLoadedModule.js: parsed 31287 → 31287 (0), gzip 7929 → 7929 (0)
  • socketModule.js: parsed 26992 → 26962 (-30), gzip 8019 → 8053 (+34)
  • createNewModule.js: parsed 8523 → 8517 (-6), gzip 3550 → 3561 (+11)
  • odspPointInTime.js: parsed 5190 → 5184 (-6), gzip 2026 → 2028 (+2)
  • summaryModule.js: parsed 3888 → 3888 (0), gzip 1874 → 1874 (0)
  • connectionState.js: parsed 909 → 909 (0), gzip 500 → 500 (0)
  • sharedTreeAttributes.js: parsed 845 → 852 (+7), gzip 493 → 504 (+11)
  • debugAssert.js: parsed 429 → 429 (0), gzip 299 → 299 (0)
  • FluidFramework-HashFallback.js: parsed 419 → 419 (0), gzip 313 → 313 (0)

@MarioJGMsoft
MarioJGMsoft merged commit 1c1c3e1 into microsoft:main Aug 24, 2026
35 checks passed
@MarioJGMsoft
MarioJGMsoft deleted the marioja/debuglogger-free-function branch August 24, 2026 18:03
MarioJGMsoft added a commit that referenced this pull request Aug 25, 2026
#28044)

## Description

Preparatory, non-breaking half of the `ITelemetryBaseLogger.send`
breaking change, split out of #27982 per [review
feedback](#27982 (review)).
The breaking interface change stays in #27982, which is stacked on this
PR.

Internal plumbing only:

- Every internal call site passes an explicit `LogLevel`. Sites that
relied on the implicit default pass `LogLevel.essential`, preserving
behavior.
- Forwarding loggers now forward the level instead of dropping it and
letting the inner logger silently re-default: `TaggedLoggerAdapter`,
`EventAndErrorTrackingLogger`, `DevtoolsLogger`, `ConsoleVerboseLogger`,
`TelemetryOptInLogger`, `FileLogger`, `BaseFileLogger`/`CSVFileLogger`,
and the mocha test-run logger.

Making the level explicit is what enables consistent filtering and
sampling. This gets the repo there without touching public API —
`logLevel` stays optional, so there are no API report changes and no
changeset.

Implementations still accept `undefined`, deliberately. Packages
compiled before the parameter becomes required call `send(event)` with
one argument, and will for as long as those versions are supported; an
implementation assuming a defined value would silently drop those
events. For the same reason, test loggers spliced into a real container
declare `logLevel?` and forward it, while stubs that ignore the level
don't declare the parameter at all.

Part of #27595 (sub-issue of #23271).

## Reviewer Guidance

The review process is outlined in [the pull request
guidelines](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/PR-Guidelines.md#guidelines).

- Any forwarding logger still dropping the level?


> The `DebugLogger` export refactor suggested in review was split out
into #28058, which has merged. This branch is rebuilt on top of it and
no longer touches `debugLogger.ts`.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8a07af10-6ed8-4c13-bd58-176b5110a9d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: loader Loader related issues area: repo Repo related work area: tools area: website base: main PRs targeted against main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants