Check Debug logs are enabled for hot path

This commit is contained in:
Chad Currie
2022-03-02 01:49:41 +13:00
committed by Michael Latouche
parent a72698e1a9
commit 6b3a589aa0

View File

@@ -608,7 +608,10 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
throw new ArgumentException("Kit content cannot have children.", nameof(kit));
// ReSharper restore LocalizableElement
_logger.LogDebug("Set content ID: {KitNodeId}", kit.Node.Id);
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug("Set content ID: {KitNodeId}", kit.Node.Id);
}
// get existing
_contentNodes.TryGetValue(kit.Node.Id, out var link);
@@ -727,7 +730,11 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
previousNode = null; // there is no previous sibling
}
_logger.LogDebug("Set {thisNodeId} with parent {thisNodeParentContentId}", thisNode.Id, thisNode.ParentContentId);
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug("Set {thisNodeId} with parent {thisNodeParentContentId}", thisNode.Id, thisNode.ParentContentId);
}
SetValueLocked(_contentNodes, thisNode.Id, thisNode);
// if we are initializing from the database source ensure the local db is updated
@@ -784,7 +791,12 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
ok = false;
continue; // skip that one
}
_logger.LogDebug("Set {kitNodeId} with parent {kitNodeParentContentId}", kit.Node.Id, kit.Node.ParentContentId);
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug("Set {kitNodeId} with parent {kitNodeParentContentId}", kit.Node.Id, kit.Node.ParentContentId);
}
SetValueLocked(_contentNodes, kit.Node.Id, kit.Node);
if (_localDb != null) RegisterChange(kit.Node.Id, kit);
@@ -873,7 +885,11 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
if (link?.Value == null) return false;
var content = link.Value;
_logger.LogDebug("Clear content ID: {ContentId}", content.Id);
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug("Clear content ID: {ContentId}", content.Id);
}
// clear the entire branch
ClearBranchLocked(content);