From f10307c72d28c1afc3318ce45787971063d49a1c Mon Sep 17 00:00:00 2001 From: Matt Portune <59324545+mportune-bw@users.noreply.github.com> Date: Mon, 21 Mar 2022 16:44:54 -0400 Subject: [PATCH] Remove verbose state & value storage debug logging (#1857) --- src/Core/Services/StateService.cs | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/src/Core/Services/StateService.cs b/src/Core/Services/StateService.cs index 131ddb7d4..f26df9457 100644 --- a/src/Core/Services/StateService.cs +++ b/src/Core/Services/StateService.cs @@ -1,7 +1,6 @@ using System; using Bit.Core.Abstractions; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Bit.Core.Enums; @@ -9,7 +8,6 @@ using Bit.Core.Models.Data; using Bit.Core.Models.Domain; using Bit.Core.Models.View; using Bit.Core.Utilities; -using Newtonsoft.Json; namespace Bit.Core.Services { @@ -1183,20 +1181,16 @@ namespace Bit.Core.Services private async Task GetValueAsync(string key, StorageOptions options) { - var value = await GetStorageService(options).GetAsync(key); - Log("GET", options, key, JsonConvert.SerializeObject(value)); - return value; + return await GetStorageService(options).GetAsync(key); } private async Task SetValueAsync(string key, T value, StorageOptions options) { if (value == null) { - Log("REMOVE", options, key, null); await GetStorageService(options).RemoveAsync(key); return; } - Log("SET", options, key, JsonConvert.SerializeObject(value)); await GetStorageService(options).SaveAsync(key, value); } @@ -1512,19 +1506,12 @@ namespace Bit.Core.Services private async Task GetStateFromStorageAsync() { - var state = await _storageService.GetAsync(Constants.StateKey); - // TODO Remove logging once all bugs are squished - Debug.WriteLine(JsonConvert.SerializeObject(state, Formatting.Indented), - ">>> GetStateFromStorageAsync()"); - return state; + return await _storageService.GetAsync(Constants.StateKey); } private async Task SaveStateToStorageAsync(State state) { await _storageService.SaveAsync(Constants.StateKey, state); - // TODO Remove logging once all bugs are squished - Debug.WriteLine(JsonConvert.SerializeObject(state, Formatting.Indented), - ">>> SaveStateToStorageAsync()"); } private async Task CheckStateAsync() @@ -1567,17 +1554,5 @@ namespace Bit.Core.Services } throw new Exception("User does not exist in account list"); } - - private void Log(string tag, StorageOptions options, string key, string value) - { - // TODO Remove this once all bugs are squished - var text = options?.UseSecureStorage ?? false ? "SECURE / " : ""; - text += "Key: " + key + " / "; - if (value != null) - { - text += "Value: " + value; - } - Debug.WriteLine(text, ">>> " + tag); - } } }