Cleanup ILogger

This commit is contained in:
Stephan
2018-04-03 16:15:59 +02:00
parent e3c6205d0c
commit 553de2ea68
37 changed files with 122 additions and 292 deletions

View File

@@ -232,7 +232,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
return null;
}
}
private ISearcher GetSearchProviderSafe()
{
if (_searchProvider != null)
@@ -333,9 +333,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 ({0} times) to retrieve medias from Examine index and had to load"
+ " them from DB. This may indicate that the Examine index is corrupted.",
() => 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.");
return ConvertFromIMedia(media);
}
@@ -352,9 +351,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
: ConvertFromXPathNavigator(media.Current);
}
Current.Logger.Warn<PublishedMediaCache>(
"Could not retrieve media {0} from Examine index or from legacy library.GetMedia method",
() => id);
Current.Logger.Warn<PublishedMediaCache>(() =>
$"Could not retrieve media {id} from Examine index or from legacy library.GetMedia method");
return null;
}
@@ -362,7 +360,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
internal CacheValues ConvertFromSearchResult(SearchResult searchResult)
{
// note: fixing fields in 7.x, removed by Shan for 8.0
return new CacheValues
{
Values = searchResult.Fields,

View File

@@ -62,7 +62,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (touched == false) return;
_logger.Debug<XmlStoreFilePersister>("Created, save in {0}ms.", () => WaitMilliseconds);
_logger.Debug<XmlStoreFilePersister>(() => $"Created, save in {WaitMilliseconds}ms.");
_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 {0}ms.", () => WaitMilliseconds);
_logger.Debug<XmlStoreFilePersister>(() => $"Touched, was idle, start and save in {WaitMilliseconds}ms.");
_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 {0}ms.", () => WaitMilliseconds);
_logger.Debug<XmlStoreFilePersister>(() => $"Touched, was waiting, can delay, save in {WaitMilliseconds}ms.");
_timer.Change(WaitMilliseconds, 0);
}
else