FIRST PASS - Updates Umbraco.Web project to not use the func overload & to use new message template instead

This commit is contained in:
Warren
2018-08-14 22:36:47 +01:00
parent 2a298aaaf5
commit 23ed9773bc
35 changed files with 159 additions and 152 deletions

View File

@@ -108,7 +108,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
else
{
// this is a property that does not correspond to anything, ignore and log
Current.Logger.Warn<PublishedMediaCache>(() => "Dropping property \"" + i.Key + "\" because it does not belong to the content type.");
Current.Logger.Warn<PublishedMediaCache>("Dropping property '{PropertyKey}' because it does not belong to the content type.", i.Key);
}
}
}

View File

@@ -330,8 +330,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
var miss = Interlocked.CompareExchange(ref _examineIndexMiss, 0, 0); // volatile read
if (miss < ExamineIndexMissMax && Interlocked.Increment(ref _examineIndexMiss) == ExamineIndexMissMax)
Current.Logger.Warn<PublishedMediaCache>(() => $"Failed ({ExamineIndexMissMax} times) to retrieve medias from Examine index and had to load"
+ " them from DB. This may indicate that the Examine index is corrupted.");
Current.Logger.Warn<PublishedMediaCache>("Failed ({ExamineIndexMissMax} times) to retrieve medias from Examine index and had to load"
+ " them from DB. This may indicate that the Examine index is corrupted.", ExamineIndexMissMax);
return ConvertFromIMedia(media);
}
@@ -348,8 +348,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
: ConvertFromXPathNavigator(media.Current);
}
Current.Logger.Warn<PublishedMediaCache>(() =>
$"Could not retrieve media {id} from Examine index or from legacy library.GetMedia method");
Current.Logger.Warn<PublishedMediaCache>("Could not retrieve media {MediaId} from Examine index or from legacy library.GetMedia method", id);
return null;
}

View File

@@ -1038,7 +1038,8 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder";
{
foreach (var payload in payloads)
{
Current.Logger.Debug<XmlStore>(() => $"Notified {payload.ChangeTypes} for content {payload.Id}.");
//WB: TODO Check ChangeTypes as its an enum (be nice to get the text & not 0, 1, 2)
Current.Logger.Debug<XmlStore>("Notified {ChangeTypes} for content {ContentId}", payload.ChangeTypes, payload.Id);
if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshAll))
{
@@ -1071,7 +1072,8 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder";
if (content == null || content.Published == false || content.Trashed)
{
// no published version
Current.Logger.Debug<XmlStore>(() => $"Notified, content {payload.Id} has no published version.");
Current.Logger.Debug<XmlStore>("Notified, content {ContentId} has no published version.", payload.Id);
if (current != null)
{
// remove from xml if exists
@@ -1109,7 +1111,8 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder";
if (dtos.MoveNext() == false)
{
// gone fishing, remove (possible race condition)
Current.Logger.Debug<XmlStore>(() => $"Notifified, content {payload.Id} gone fishing.");
Current.Logger.Debug<XmlStore>("Notified, content {ContentId} gone fishing.", payload.Id);
if (current != null)
{
// remove from xml if exists
@@ -1222,7 +1225,8 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder";
.ToArray();
foreach (var payload in payloads)
Current.Logger.Debug<XmlStore>(() => $"Notified {payload.ChangeTypes} for content type {payload.Id}.");
//WB: TODO Check ChangeTypes as its an enum (be nice to get the text & not 0, 1, 2)
Current.Logger.Debug<XmlStore>("Notified {ChangeTypes} for content type {ContentTypeId}", payload.ChangeTypes, payload.Id);
if (ids.Length > 0) // must have refreshes, not only removes
RefreshContentTypes(ids);
@@ -1239,9 +1243,11 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder";
// the types will be reloaded if/when needed
foreach (var payload in payloads)
_contentTypeCache.ClearDataType(payload.Id);
foreach (var payload in payloads)
Current.Logger.Debug<XmlStore>(() => $"Notified {(payload.Removed ? "Removed" : "Refreshed")} for data type {payload.Id}.");
Current.Logger.Debug<XmlStore>("Notified {RemovedStatus} for data type {payload.Id}",
payload.Removed ? "Removed" : "Refreshed",
payload.Id);
// that's all we need to do as the changes have NO impact whatsoever on the Xml content

View File

@@ -62,7 +62,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (touched == false) return;
_logger.Debug<XmlStoreFilePersister>(() => $"Created, save in {WaitMilliseconds}ms.");
_logger.Debug<XmlStoreFilePersister>("Created, save in {WaitMilliseconds}ms.", WaitMilliseconds);
_initialTouch = DateTime.Now;
_timer = new Timer(_ => TimerRelease());
_timer.Change(WaitMilliseconds, 0);
@@ -107,7 +107,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
else if (_timer == null) // we don't have a timer yet
{
_logger.Debug<XmlStoreFilePersister>(() => $"Touched, was idle, start and save in {WaitMilliseconds}ms.");
_logger.Debug<XmlStoreFilePersister>("Touched, was idle, start and save in {WaitMilliseconds}ms.", WaitMilliseconds);
_initialTouch = DateTime.Now;
_timer = new Timer(_ => TimerRelease());
_timer.Change(WaitMilliseconds, 0);
@@ -120,7 +120,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (DateTime.Now - _initialTouch < TimeSpan.FromMilliseconds(MaxWaitMilliseconds))
{
_logger.Debug<XmlStoreFilePersister>(() => $"Touched, was waiting, can delay, save in {WaitMilliseconds}ms.");
_logger.Debug<XmlStoreFilePersister>("Touched, was waiting, can delay, save in {WaitMilliseconds}ms.", WaitMilliseconds);
_timer.Change(WaitMilliseconds, 0);
}
else