refactor(container-runtime): Tighten up exposure of ContainerRuntime's logger#20839
Conversation
⯅ @fluid-example/bundle-size-tests: +385 Bytes
Baseline commit: a5f84ed |
8d2cad9 to
929e123
Compare
alexvy86
left a comment
There was a problem hiding this comment.
I'm still uneasy with the changes here. Didn't we decide to update it to be completely non-breaking to anything? Just add the new baseLogger property where it makes sense and deprecate the old one, pointing users to use the new one? There's still plenty of alpha types that are getting breaking changes here.
| "typeValidation": { | ||
| "broken": { | ||
| "InterfaceDeclaration_IDataObjectProps": { | ||
| "forwardCompat": false, |
There was a problem hiding this comment.
Revert since we don't have changes in this package.
There was a problem hiding this comment.
Seems like it does affected this package. Type error was thrown after rebasing from main
There was a problem hiding this comment.
Oh, because the interface has a property of a type that we're breaking... so back to my general comment on the last review, I thought we had decided to make all changes here non-breaking?
b9073b9 to
c4cf077
Compare
…s logger (microsoft#20839) ## Description ContainerRuntime.logger is currently public, though ideally, it should not be, and it uses an internal type instead of the preferable base type. When sharing the logger, the standard practice should be to pass around the base logger, allowing each consumer to create a ChildLogger from it. ## Changes * Rename ContainerRuntime.logger to ContainerRuntime.baseLogger, change its type to ITelemetryBaseLogger, and set its access level to private. * Adjust the dependencies that receive the logger to accept the ITelemetryBaseLogger type and utilize createChildLogger to create a child logger as needed (this operation will be a no-op if the logger is already a child logger). * Modify the following classes in Fluid Framework (FF) so they no longer directly access the logger from the runtime but instead receive their own base logger via constructor parameters: BlobManager Summarizer DataStoreContext * DataStoreContext currently makes the same logger available through its public API. This may be unnecessary—as indicated by its lack of use in the FF codebase—especially since IFluidDataStoreRuntime already exposes a logger. This exposure could potentially be removed to streamline the API and enhance encapsulation.
Description
ContainerRuntime.logger is currently public, though ideally, it should not be, and it uses an internal type instead of the preferable base type. When sharing the logger, the standard practice should be to pass around the base logger, allowing each consumer to create a ChildLogger from it.
Changes
Rename ContainerRuntime.logger to ContainerRuntime.baseLogger, change its type to ITelemetryBaseLogger, and set its access level to private.
Adjust the dependencies that receive the logger to accept the ITelemetryBaseLogger type and utilize createChildLogger to create a child logger as needed (this operation will be a no-op if the logger is already a child logger).
Modify the following classes in Fluid Framework (FF) so they no longer directly access the logger from the runtime but instead receive their own base logger via constructor parameters:
BlobManager
Summarizer
DataStoreContext