about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/LogView.razor
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-23 08:51:02 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-23 08:51:02 +0200
commit3ef3e5caa65458e595e2303358322626c7da1dda (patch)
tree6a60d401da8b5f906a423601ac4c135d44e896d1 /MatrixRoomUtils.Web/Shared/LogView.razor
parentLocal changes (diff)
downloadMatrixUtils-3ef3e5caa65458e595e2303358322626c7da1dda.tar.xz
Add numerous new things
Diffstat (limited to 'MatrixRoomUtils.Web/Shared/LogView.razor')
-rw-r--r--MatrixRoomUtils.Web/Shared/LogView.razor26
1 files changed, 20 insertions, 6 deletions
diff --git a/MatrixRoomUtils.Web/Shared/LogView.razor b/MatrixRoomUtils.Web/Shared/LogView.razor
index f60f271..80fd355 100644
--- a/MatrixRoomUtils.Web/Shared/LogView.razor
+++ b/MatrixRoomUtils.Web/Shared/LogView.razor
@@ -1,13 +1,27 @@
 @using System.Text
-<u>Logs</u><br/>
-<pre>
-    @_stringBuilder
-</pre>
+@if (LocalStorageWrapper.Settings.DeveloperSettings.EnableLogViewers)
+{
+    <u>Logs</u>
+    <br/>
+    <pre>
+        @_stringBuilder
+    </pre>
+}
 
 @code {
     StringBuilder _stringBuilder = new();
-    protected override void OnInitialized()
+    protected override async Task OnInitializedAsync()
     {
+        await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
+        if (!LocalStorageWrapper.Settings.DeveloperSettings.EnableConsoleLogging)
+        {
+            Console.WriteLine("Console logging disabled!");
+            var _sw = new StringWriter();
+            Console.SetOut(_sw);
+            Console.SetError(_sw);
+            return;
+        }
+        if (!LocalStorageWrapper.Settings.DeveloperSettings.EnableLogViewers) return;
         //intecept stdout with textwriter to get logs
         var sw = new StringWriter(_stringBuilder);
         Console.SetOut(sw);
@@ -27,6 +41,6 @@
             }
     // ReSharper disable once FunctionNeverReturns - This is intentional behavior
         });
-        base.OnInitialized();
+        await base.OnInitializedAsync();
     }
 }
\ No newline at end of file