mirror of
https://github.com/Readarr/Readarr
synced 2025-12-14 04:13:37 +01:00
Lazyload logging
This commit is contained in:
parent
b50b0a1411
commit
0a33fd98cc
1 changed files with 10 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
|
||||
namespace NzbDrone.Core.Datastore
|
||||
{
|
||||
|
|
@ -74,6 +76,8 @@ public bool ShouldSerializeValue()
|
|||
/// <typeparam name="TChild">The child entity that is being lazy loaded.</typeparam>
|
||||
internal class LazyLoaded<TParent, TChild> : LazyLoaded<TChild>
|
||||
{
|
||||
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(LazyLoaded<TParent, TChild>));
|
||||
|
||||
private readonly Func<IDatabase, TParent, TChild> _query;
|
||||
private readonly Func<TParent, bool> _condition;
|
||||
|
||||
|
|
@ -115,6 +119,12 @@ public override void LazyLoad()
|
|||
{
|
||||
if (_condition != null && _condition(_parent))
|
||||
{
|
||||
if (SqlBuilderExtensions.LogSql)
|
||||
{
|
||||
Logger.Trace($"Lazy loading {typeof(TChild)} for {typeof(TParent)}");
|
||||
Logger.Trace("StackTrace: '{0}'", Environment.StackTrace);
|
||||
}
|
||||
|
||||
_value = _query(_database, _parent);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue