From c727f93565cf2baf77cdcff7381e9ef23b43388e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Buratto?= <46575243+joaoburatto@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:43:24 -0300 Subject: [PATCH] Fix missing changes --- Assets/Scripts/SS3D/Core/LogManager.cs | 26 ++++++++----------- .../Inventory/Containers/AttachedContainer.cs | 2 +- .../Inventory/Containers/HumanInventory.cs | 4 +-- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Assets/Scripts/SS3D/Core/LogManager.cs b/Assets/Scripts/SS3D/Core/LogManager.cs index a5b4036afe..1dec1b69cd 100644 --- a/Assets/Scripts/SS3D/Core/LogManager.cs +++ b/Assets/Scripts/SS3D/Core/LogManager.cs @@ -1,17 +1,13 @@ using Serilog; using Serilog.Sinks.Unity3D; -using Serilog.Core; using Serilog.Events; using Serilog.Formatting.Compact; using UnityEngine; using FishNet; using System; -using System.Linq; -using System.Collections.Generic; using SS3D.Logging.LogSettings; using SS3D.Logging; using SS3D.Data; -using FishNet.Configuring; using Log = Serilog.Log; @@ -25,28 +21,28 @@ namespace SS3D.Core /// public static class LogManager { - private static readonly string defaultUnityLogTemplate; + private static readonly string DefaultUnityLogTemplate; private static readonly string LogFolderPath; - private static bool _isInitialized; + private static bool IsInitialized; - private static LogSettings settings; + private static readonly LogSettings Settings; static LogManager() { - defaultUnityLogTemplate = "{SourceContext} {Message}{NewLine}{Exception}"; + DefaultUnityLogTemplate = "{SourceContext} {Message}{NewLine}{Exception}"; LogFolderPath = Application.dataPath + "/../Logs/"; if (Application.isPlaying) { - settings = Assets.Get(Data.Enums.AssetDatabases.Settings, (int)Data.Enums.SettingsId.LogSettings); + Settings = Assets.Get(Data.Enums.AssetDatabases.Settings, (int)Data.Enums.SettingsId.LogSettings); } } public static void Initialize() { - if (_isInitialized) return; - _isInitialized = true; + if (IsInitialized) return; + IsInitialized = true; var configuration = new LoggerConfiguration(); @@ -56,7 +52,7 @@ public static void Initialize() } // Configure writing to Unity's console, using our custom text formatter. - configuration = configuration.WriteTo.Unity3D(formatter: new SS3DUnityTextFormatter(outputTemplate: defaultUnityLogTemplate)); + configuration = configuration.WriteTo.Unity3D(formatter: new SS3DUnityTextFormatter(outputTemplate: DefaultUnityLogTemplate)); @@ -79,9 +75,9 @@ private static LoggerConfiguration ConfigureForPlayMode(LoggerConfiguration conf // Apply some override on the minimum logging level for some namespaces using the log settings. // Does not apply override if the logging level corresponds to the global minimum level. - foreach (var levelForNameSpace in settings.SS3DNameSpaces) + foreach (var levelForNameSpace in Settings.SS3DNameSpaces) { - if (levelForNameSpace.Level == settings.defaultLogLevel) continue; + if (levelForNameSpace.Level == Settings.defaultLogLevel) continue; configuration = configuration.MinimumLevel.Override(levelForNameSpace.Name, levelForNameSpace.Level); } @@ -112,7 +108,7 @@ private static LoggerConfiguration ConfigureForPlayMode(LoggerConfiguration conf /// private static LoggerConfiguration ConfigureMinimumLevel(LoggerConfiguration loggerConfiguration) { - switch (settings.defaultLogLevel) + switch (Settings.defaultLogLevel) { case LogEventLevel.Verbose: return loggerConfiguration.MinimumLevel.Verbose(); case LogEventLevel.Debug: return loggerConfiguration.MinimumLevel.Debug(); diff --git a/Assets/Scripts/SS3D/Systems/Inventory/Containers/AttachedContainer.cs b/Assets/Scripts/SS3D/Systems/Inventory/Containers/AttachedContainer.cs index 54649a7ff2..5adc1121fd 100644 --- a/Assets/Scripts/SS3D/Systems/Inventory/Containers/AttachedContainer.cs +++ b/Assets/Scripts/SS3D/Systems/Inventory/Containers/AttachedContainer.cs @@ -282,7 +282,7 @@ private void HandleStoredItemsChanged(SyncListOperation op, int index, StoredIte } // This seem to be called correctly 2 move and none when moving inside, 2 remove and none when removing, 2 add and none when adding, 2 add 2 remove and none when transferring - Punpun.Information(this, "container change type is" + changeType.ToString()); + Log.Information(this, "container change type is" + changeType.ToString()); if (changeType == ContainerChangeType.None) { return; diff --git a/Assets/Scripts/SS3D/Systems/Inventory/Containers/HumanInventory.cs b/Assets/Scripts/SS3D/Systems/Inventory/Containers/HumanInventory.cs index 1c95dd7e7d..9fb2733032 100644 --- a/Assets/Scripts/SS3D/Systems/Inventory/Containers/HumanInventory.cs +++ b/Assets/Scripts/SS3D/Systems/Inventory/Containers/HumanInventory.cs @@ -306,13 +306,13 @@ private void CmdTransferItem(GameObject itemObject, Vector2Int position, Attache // Can't put an item in its own container if (item.GetComponentsInChildren().AsEnumerable().Contains(container)){ - Punpun.Warning(this, "can't put an item in its own container"); + Log.Warning(this, "can't put an item in its own container"); return; } if (container == null) { - Punpun.Error(this, $"Client sent invalid container reference: NetId {container.ObjectId}"); + Log.Error(this, $"Client sent invalid container reference: NetId {container.ObjectId}"); return; }