Change calls to logger.Debug method to use Func<string> parameter
This commit is contained in:
@@ -443,7 +443,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
throw new ArgumentException("Kit content cannot have children.", nameof(kit));
|
||||
// ReSharper restore LocalizableElement
|
||||
|
||||
_logger.Debug<ContentStore>("Set content ID:" + kit.Node.Id);
|
||||
_logger.Debug<ContentStore>(() => "Set content ID:" + kit.Node.Id);
|
||||
|
||||
var lockInfo = new WriteLockInfo();
|
||||
try
|
||||
@@ -568,7 +568,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
if (link?.Value == null) return false;
|
||||
|
||||
var content = link.Value;
|
||||
_logger.Debug<ContentStore>("Clear content ID:" + content.Id);
|
||||
_logger.Debug<ContentStore>(() => "Clear content ID:" + content.Id);
|
||||
|
||||
// clear the entire branch
|
||||
ClearBranchLocked(content);
|
||||
@@ -909,7 +909,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
{
|
||||
// see notes in CreateSnapshot
|
||||
#if DEBUG
|
||||
_logger.Debug<ContentStore>("Collect.");
|
||||
_logger.Debug<ContentStore>(() => "Collect.");
|
||||
#endif
|
||||
while (_genRefRefs.TryPeek(out GenRefRef genRefRef) && (genRefRef.Count == 0 || genRefRef.WGenRef.IsAlive == false))
|
||||
{
|
||||
@@ -1086,7 +1086,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
#if DEBUG
|
||||
_logger = logger;
|
||||
_logger.Debug<Snapshot>("Creating snapshot.");
|
||||
_logger.Debug<Snapshot>(() => "Creating snapshot.");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1101,7 +1101,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
#if DEBUG
|
||||
_logger = logger;
|
||||
_logger.Debug<Snapshot>("Creating live.");
|
||||
_logger.Debug<Snapshot>(() => "Creating live.");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1182,7 +1182,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
{
|
||||
if (_gen < 0) return;
|
||||
#if DEBUG
|
||||
_logger.Debug<Snapshot>("Dispose snapshot (" + (_genRef?.GenRefRef.Count.ToString() ?? "live") + ").");
|
||||
_logger.Debug<Snapshot>(() => "Dispose snapshot (" + (_genRef?.GenRefRef.Count.ToString() ?? "live") + ").");
|
||||
#endif
|
||||
_gen = -1;
|
||||
if (_genRef != null)
|
||||
|
||||
@@ -298,12 +298,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
_localContentDb?.Clear();
|
||||
|
||||
_logger.Debug<PublishedSnapshotService>("Loading content from database...");
|
||||
_logger.Debug<PublishedSnapshotService>(() => "Loading content from database...");
|
||||
var sw = Stopwatch.StartNew();
|
||||
var kits = _dataSource.GetAllContentSources(scope);
|
||||
_contentStore.SetAll(kits);
|
||||
sw.Stop();
|
||||
_logger.Debug<PublishedSnapshotService>("Loaded content from database (" + sw.ElapsedMilliseconds + "ms).");
|
||||
_logger.Debug<PublishedSnapshotService>(() => "Loaded content from database (" + sw.ElapsedMilliseconds + "ms).");
|
||||
}
|
||||
|
||||
private void LoadContentFromLocalDbLocked(IScope scope)
|
||||
@@ -312,12 +312,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
.Select(x => _publishedContentTypeFactory.CreateContentType(x));
|
||||
_contentStore.UpdateContentTypes(null, contentTypes, null);
|
||||
|
||||
_logger.Debug<PublishedSnapshotService>("Loading content from local db...");
|
||||
_logger.Debug<PublishedSnapshotService>(() => "Loading content from local db...");
|
||||
var sw = Stopwatch.StartNew();
|
||||
var kits = _localContentDb.Select(x => x.Value).OrderBy(x => x.Node.Level);
|
||||
_contentStore.SetAll(kits);
|
||||
sw.Stop();
|
||||
_logger.Debug<PublishedSnapshotService>("Loaded content from local db (" + sw.ElapsedMilliseconds + "ms).");
|
||||
_logger.Debug<PublishedSnapshotService>(() => "Loaded content from local db (" + sw.ElapsedMilliseconds + "ms).");
|
||||
}
|
||||
|
||||
// keep these around - might be useful
|
||||
@@ -365,12 +365,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
_localMediaDb?.Clear();
|
||||
|
||||
_logger.Debug<PublishedSnapshotService>("Loading media from database...");
|
||||
_logger.Debug<PublishedSnapshotService>(() => "Loading media from database...");
|
||||
var sw = Stopwatch.StartNew();
|
||||
var kits = _dataSource.GetAllMediaSources(scope);
|
||||
_mediaStore.SetAll(kits);
|
||||
sw.Stop();
|
||||
_logger.Debug<PublishedSnapshotService>("Loaded media from database (" + sw.ElapsedMilliseconds + "ms).");
|
||||
_logger.Debug<PublishedSnapshotService>(() => "Loaded media from database (" + sw.ElapsedMilliseconds + "ms).");
|
||||
}
|
||||
|
||||
private void LoadMediaFromLocalDbLocked(IScope scope)
|
||||
@@ -379,12 +379,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
.Select(x => _publishedContentTypeFactory.CreateContentType(x));
|
||||
_mediaStore.UpdateContentTypes(null, mediaTypes, null);
|
||||
|
||||
_logger.Debug<PublishedSnapshotService>("Loading media from local db...");
|
||||
_logger.Debug<PublishedSnapshotService>(() => "Loading media from local db...");
|
||||
var sw = Stopwatch.StartNew();
|
||||
var kits = _localMediaDb.Select(x => x.Value);
|
||||
_mediaStore.SetAll(kits);
|
||||
sw.Stop();
|
||||
_logger.Debug<PublishedSnapshotService>("Loaded media from local db (" + sw.ElapsedMilliseconds + "ms).");
|
||||
_logger.Debug<PublishedSnapshotService>(() => "Loaded media from local db (" + sw.ElapsedMilliseconds + "ms).");
|
||||
}
|
||||
|
||||
// keep these around - might be useful
|
||||
@@ -551,7 +551,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
foreach (var payload in payloads)
|
||||
{
|
||||
_logger.Debug<PublishedSnapshotService>($"Notified {payload.ChangeTypes} for content {payload.Id}");
|
||||
_logger.Debug<PublishedSnapshotService>(() => $"Notified {payload.ChangeTypes} for content {payload.Id}");
|
||||
|
||||
if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshAll))
|
||||
{
|
||||
@@ -641,7 +641,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
foreach (var payload in payloads)
|
||||
{
|
||||
_logger.Debug<PublishedSnapshotService>($"Notified {payload.ChangeTypes} for media {payload.Id}");
|
||||
_logger.Debug<PublishedSnapshotService>(() => $"Notified {payload.ChangeTypes} for media {payload.Id}");
|
||||
|
||||
if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshAll))
|
||||
{
|
||||
@@ -710,7 +710,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return;
|
||||
|
||||
foreach (var payload in payloads)
|
||||
_logger.Debug<PublishedSnapshotService>($"Notified {payload.ChangeTypes} for {payload.ItemType} {payload.Id}");
|
||||
_logger.Debug<PublishedSnapshotService>(() => $"Notified {payload.ChangeTypes} for {payload.ItemType} {payload.Id}");
|
||||
|
||||
Notify<IContentType>(_contentStore, payloads, RefreshContentTypesLocked);
|
||||
Notify<IMediaType>(_mediaStore, payloads, RefreshMediaTypesLocked);
|
||||
@@ -760,7 +760,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
var idsA = payloads.Select(x => x.Id).ToArray();
|
||||
|
||||
foreach (var payload in payloads)
|
||||
_logger.Debug<PublishedSnapshotService>($"Notified {(payload.Removed ? "Removed" : "Refreshed")} for data type {payload.Id}");
|
||||
_logger.Debug<PublishedSnapshotService>(() => $"Notified {(payload.Removed ? "Removed" : "Refreshed")} for data type {payload.Id}");
|
||||
|
||||
using (_contentStore.GetWriter(_scopeProvider))
|
||||
using (_mediaStore.GetWriter(_scopeProvider))
|
||||
|
||||
Reference in New Issue
Block a user