Skip to content

Commit

Permalink
chore: unified more initialisation logging
Browse files Browse the repository at this point in the history
  • Loading branch information
MSchmoecker committed Sep 27, 2023
1 parent 545e9d6 commit b6a569d
Show file tree
Hide file tree
Showing 22 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Fixed some errors when a Jotunn dependent mod has no BepInEx dependency set and loads before Jotunn. A warning will be logged
* Fixed items were not added to the main menu ObjectDB if added in the OnVanillaPrefabsAvailable event and thus not visually shown on the player
* Fixed input block did not prevent mouse wheel character zoom
* Improved module initialisation logging by unifying messages

## Version 2.14.0
* Fixed the SynchronizationManager wasn't always initialised, resulting in no sync of admin configs
Expand Down
6 changes: 3 additions & 3 deletions JotunnLib/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ private void InitializePatches()
}
}

internal static void LogManagerInit(string manager)
internal static void LogInit(string module)
{
Jotunn.Logger.LogInfo($"Initializing {manager}");
Jotunn.Logger.LogInfo($"Initializing {module}");

if (!Instance)
{
string message = $"{manager} was accessed before Jotunn Awake, this can cause unexpected behaviour. " +
string message = $"{module} was accessed before Jotunn Awake, this can cause unexpected behaviour. " +
"Please make sure to add `[BepInDependency(Jotunn.Main.ModGuid)]` next to your BaseUnityPlugin";
Jotunn.Logger.LogWarning(BepInExUtils.GetSourceModMetadata(), message);
}
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/CommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static CommandManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("CommandManager");
Main.LogInit("CommandManager");
AddConsoleCommand(new ClearCommand());

Main.Harmony.PatchAll(typeof(Patches));
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/CreatureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static CreatureManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("CreatureManager");
Main.LogInit("CreatureManager");

SpawnListContainer = new GameObject("Creatures");
SpawnListContainer.transform.parent = Main.RootObject.transform;
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/GUIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private static void TextInput_IsVisible(ref bool __result)
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("GUIManager");
Main.LogInit("GUIManager");

// Cache headless state
Headless = SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null;
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static InputManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("InputManager");
Main.LogInit("InputManager");

// Dont init on a dedicated server
if (!GUIManager.IsHeadless())
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/ItemManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static ItemManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("ItemManager");
Main.LogInit("ItemManager");
Main.Harmony.PatchAll(typeof(Patches));
PrefabManager.Instance.Activate();
}
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/KeyHintManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static KeyHintManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("KeyHintManager");
Main.LogInit("KeyHintManager");

// Dont init on a headless server
if (!GUIManager.IsHeadless())
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/KitbashManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static KitbashManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("KitbashManager");
Main.LogInit("KitbashManager");
ItemManager.OnKitbashItemsAvailable += ApplyKitbashes;
}

Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/LocalizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static LocalizationManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("LocalizationManager");
Main.LogInit("LocalizationManager");

Main.Harmony.PatchAll(typeof(Patches));

Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/MinimapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static MinimapManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("MinimapManager");
Main.LogInit("MinimapManager");

// Dont init on a headless server
if (GUIManager.IsHeadless())
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/MockSystem/MockManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private MockManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("MockManager");
Main.LogInit("MockManager");

MockPrefabContainer = new GameObject("MockPrefabs");
MockPrefabContainer.transform.parent = Main.RootObject.transform;
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static NetworkManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("NetworkManager");
Main.LogInit("NetworkManager");
Main.Harmony.PatchAll(typeof(Patches));
}

Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/PieceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static class PieceCategorySettings
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("PieceManager");
Main.LogInit("PieceManager");
Main.Harmony.PatchAll(typeof(Patches));
PrefabManager.Instance.Activate();
}
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/PrefabManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static PrefabManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("PrefabManager");
Main.LogInit("PrefabManager");

PrefabContainer = new GameObject("Prefabs");
PrefabContainer.transform.parent = Main.RootObject.transform;
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/RenderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static RenderManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("RenderManager");
Main.LogInit("RenderManager");

if (GUIManager.IsHeadless())
{
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/SkillManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static SkillManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("SkillManager");
Main.LogInit("SkillManager");
Main.Harmony.PatchAll(typeof(Patches));
}

Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/SynchronizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private SynchronizationManager() { }
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("SynchronizationManager");
Main.LogInit("SynchronizationManager");

// Register RPCs and the admin watchdog
ConfigRPC = NetworkManager.Instance.AddRPC(
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/UndoManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static UndoManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("UndoManager");
Main.LogInit("UndoManager");
Main.Harmony.PatchAll(typeof(Patches));
}

Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Managers/ZoneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static ZoneManager()
/// </summary>
void IManager.Init()
{
Main.LogManagerInit("ZoneManager");
Main.LogInit("ZoneManager");

LocationContainer = new GameObject("Locations");
LocationContainer.transform.parent = Main.RootObject.transform;
Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Utils/ModCompatibility/ModCompatibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class ModCompatibility

internal static void Init()
{
Logger.LogInfo("Initializing ModCompatibility");
Main.LogInit("ModCompatibility");
Main.Harmony.PatchAll(typeof(ModCompatibility));
}

Expand Down
2 changes: 1 addition & 1 deletion JotunnLib/Utils/ModQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ModQuery

internal static void Init()
{
Logger.LogInfo("Initializing ModQuery");
Main.LogInit("ModQuery");
Main.Harmony.PatchAll(typeof(ModQuery));
}

Expand Down

0 comments on commit b6a569d

Please sign in to comment.