Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds explicit ILogger.IsEnabled(LogLevel.X) guards around many LogDebug/LogTrace/LogInformation calls across uSync Core and BackOffice to avoid unnecessary work when those levels are disabled (per CA1873 guidance).
Changes:
- Wrapped many
LogDebug,LogTrace, andLogInformationcalls withIsEnabled(...)checks across serializers, handlers, services, and notifications. - Minor logging behavior adjustments in a few places (some log removals and some log level changes).
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| uSync.Core/Serialization/SyncSerializerRoot.cs | Adds IsEnabled(Debug/Trace) guards around serializer root debug/trace logs; one delete log was removed. |
| uSync.Core/Serialization/SyncContainerSerializerBase.cs | Guards debug logs in container delete handling and parent discovery flow. |
| uSync.Core/Serialization/Serializers/TemplateSerializer.cs | Guards debug logs during template import/content resolution and save; contains a log-message typo. |
| uSync.Core/Serialization/Serializers/LanguageSerializer.cs | Removes an unguarded debug log in second pass. |
| uSync.Core/Serialization/Serializers/DictionaryItemSerializer.cs | Adds debug guard for “force key sync”; changes key-mismatch log from Information to Warning. |
| uSync.Core/Serialization/Serializers/DataTypeSerializer.cs | Guards debug logs in delete/config handling; retains a stray “)” in a message. |
| uSync.Core/Serialization/Serializers/ContentTypeSerializer.cs | Guards debug log for alias cache timing and other debug statements. |
| uSync.Core/Serialization/Serializers/ContentTypeBaseSerializer.cs | Guards many debug/info logs; retains inconsistent structured logging placeholder {aliaS} and a message typo. |
| uSync.Core/Serialization/Serializers/ContentSerializerBase.cs | Guards debug/trace logs in content deserialization; changes regex parse log from Debug to Warning. |
| uSync.Core/Mapping/SyncBlockMapperBase.cs | Guards debug logs for import/export block mapping. |
| uSync.Core/Mapping/Mappers/ImagePathMapper.cs | Simplifies debug logging for media folder setting (now logs “(Blank)” when empty). |
| uSync.Core/Documents/SyncDocumentUrlCleaner.cs | Guards debug log when cleaning document URLs. |
| uSync.Core/DataTypes/DataTypeSerializers/RichTextEditorMigratingSerializer.cs | Guards debug logs during RTE config migration. |
| uSync.BackOffice/SyncHandlers/SyncHandlerRoot.cs | Guards debug/trace logs during import, clean, and reporting flows. |
| uSync.BackOffice/SyncHandlers/SyncHandlerFactory.cs | Guards trace log when excluding disabled handlers. |
| uSync.BackOffice/SyncHandlers/SyncHandlerContainerBase.cs | Guards debug logs when processing container cleanup/changes. |
| uSync.BackOffice/SyncHandlers/SyncHandlerBase.cs | Guards debug/info logs for clean/delete operations. |
| uSync.BackOffice/SyncHandlers/Handlers/LanguageHandler.cs | Guards debug logs during language cleanup. |
| uSync.BackOffice/SyncHandlers/Handlers/ContentHandlerBase.cs | Guards debug logs for include/exclude path/doc-type filtering and cleanup mode. |
| uSync.BackOffice/Services/SyncService_Single.cs | Guards debug log emitted after partial import. |
| uSync.BackOffice/Services/SyncService.cs | Guards info logs for startup import/export summaries and trigger actions. |
| uSync.BackOffice/Services/SyncFileService.cs | Guards debug logs when saving files. |
| uSync.BackOffice/Services/SyncActionService.cs | Guards info logs for start/finish process reporting. |
| uSync.BackOffice/Notifications/uSyncApplicationStartingHandler.cs | Guards info logs and switches one interpolated log to structured placeholders. |
| uSync.BackOffice/Notifications/SyncScopedNotificationPublisher.cs | Guards debug logs around scoped notification publishing. |
| uSync.BackOffice/Boot/FirstBootMigration.cs | Guards info logs during first-boot import migration. |
| uSync.AutoTemplates/TemplateWatcher.cs | Guards info log when checking template files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was referenced Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
IsEnabledchecks to all LogInformation, LogDebug and LogTrace calls. in theory this is a performance improvement, because it stops the code doing any string allocations / manipulation that are not needed.(https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/quality-rules/ca1873)
(we might move to source-generated logging at a later date)