From 9c0662445e08a23e722962026737be4d90b12931 Mon Sep 17 00:00:00 2001 From: Atralupus Date: Tue, 17 Oct 2023 13:32:30 +0900 Subject: [PATCH] Add access denied debug log renaming --- .../Services/RedisAccessControlService.cs | 9 ++++++++- .../Services/SQLiteAccessControlService.cs | 12 ++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/NineChronicles.Headless/Services/RedisAccessControlService.cs b/NineChronicles.Headless/Services/RedisAccessControlService.cs index b1dfb5e74..8e0765746 100644 --- a/NineChronicles.Headless/Services/RedisAccessControlService.cs +++ b/NineChronicles.Headless/Services/RedisAccessControlService.cs @@ -1,6 +1,7 @@ using StackExchange.Redis; using Libplanet.Crypto; using Nekoyume.Blockchain; +using Serilog; namespace NineChronicles.Headless.Services { @@ -16,7 +17,13 @@ public RedisAccessControlService(string storageUri) public bool IsAccessDenied(Address address) { - return _db.KeyExists(address.ToString()); + var result = _db.KeyExists(address.ToString()); + if (result) + { + Log.Debug($"{address} is access denied"); + } + + return result; } } } diff --git a/NineChronicles.Headless/Services/SQLiteAccessControlService.cs b/NineChronicles.Headless/Services/SQLiteAccessControlService.cs index 0a9c1e456..a124ee56d 100644 --- a/NineChronicles.Headless/Services/SQLiteAccessControlService.cs +++ b/NineChronicles.Headless/Services/SQLiteAccessControlService.cs @@ -1,6 +1,7 @@ using Microsoft.Data.Sqlite; using Libplanet.Crypto; using Nekoyume.Blockchain; +using Serilog; namespace NineChronicles.Headless.Services { @@ -33,9 +34,16 @@ public bool IsAccessDenied(Address address) command.CommandText = CheckAccessSql; command.Parameters.AddWithValue("@Address", address.ToString()); - var result = command.ExecuteScalar(); + var queryResult = command.ExecuteScalar(); - return result is not null && (long)result == 1; + var result = queryResult is not null && (long)queryResult == 1; + + if (result) + { + Log.Debug($"{address} is access denied"); + } + + return result; } } }