mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-13 00:01:03 +08:00
This pull request introduces a new logging infrastructure for the CmdPal module by integrating the Microsoft.Extensions.Logging (MEL) abstraction and routing all log output through the existing `ManagedCommon.Logger`. The changes add a custom logger, logger provider, and extension method for easy registration, and update dependencies and service configuration to enable the new logging system. > This logging is not in use currently, but will be in a future PR. **Logging Infrastructure Integration:** * Added a new `CmdPalLogger` class implementing `ILogger`, which delegates logging calls to `ManagedCommon.Logger` to centralize and standardize log output. * Implemented `CmdPalLoggerProvider` to create and manage `CmdPalLogger` instances, allowing MEL-based logging throughout the application. * Introduced `CmdPalLoggingExtensions.AddCmdPalLogging` for registering the logger provider via dependency injection, ensuring all MEL logging is routed appropriately. * Updated `App.xaml.cs` to register the new logging system with `services.AddCmdPalLogging()`, enabling the infrastructure at application startup. [[1]](diffhunk://#diff-84386fa8a23e7058525bd269788bbf9e352b1f49d08e5f877059386ba3b83222R8) [[2]](diffhunk://#diff-84386fa8a23e7058525bd269788bbf9e352b1f49d08e5f877059386ba3b83222R129-R130) **Project and Dependency Updates:** * Updated the project file `Microsoft.CmdPal.Common.csproj` to reference the `ManagedCommon` project and to include a folder for the new logging code. [[1]](diffhunk://#diff-affab7e2df96d3b8073ab649e4ef5a34d459cd69e525573fd6426d698efec18fR29) [[2]](diffhunk://#diff-affab7e2df96d3b8073ab649e4ef5a34d459cd69e525573fd6426d698efec18fR64-R67)