1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
Artemis/src/Artemis.Core/Utilities/DeserializationLogger.cs
SpoinkyNL fb3466e102 Core - Nullable refactoring
Core - Nullable refactoring


Core - Nullable refactoring (finish)
2020-11-17 22:50:38 +01:00

33 lines
1.1 KiB
C#

using Newtonsoft.Json;
using Ninject;
using Serilog;
namespace Artemis.Core
{
internal static class DeserializationLogger
{
private static ILogger? _logger;
public static void Initialize(IKernel kernel)
{
_logger = kernel.Get<ILogger>();
}
public static void LogPredicateDeserializationFailure(DataModelConditionPredicate dataModelConditionPredicate, JsonException exception)
{
_logger?.Warning(
exception,
"Failed to deserialize display condition predicate {left} {operator} {right}",
dataModelConditionPredicate.Entity.LeftPath?.Path,
dataModelConditionPredicate.Entity.OperatorType,
dataModelConditionPredicate.Entity.RightPath?.Path
);
}
public static void LogModifierDeserializationFailure(string modifierName, JsonSerializationException exception)
{
_logger?.Warning(exception, "Failed to deserialize static parameter for modifier {modifierName}", modifierName);
}
}
}