Use custom logger everywhere.

This commit is contained in:
Ottermandias 2022-09-15 15:02:23 +02:00
parent fabbeeae13
commit 72ef666d51
87 changed files with 276 additions and 371 deletions

View file

@ -6,7 +6,6 @@ using System.Reflection;
using System.Text;
using Dalamud.Game.Command;
using Dalamud.Interface.Windowing;
using Dalamud.Logging;
using Dalamud.Plugin;
using EmbedIO;
using EmbedIO.WebApi;
@ -14,6 +13,7 @@ using ImGuiNET;
using Lumina.Excel.GeneratedSheets;
using OtterGui;
using OtterGui.Classes;
using OtterGui.Log;
using OtterGui.Widgets;
using Penumbra.Api;
using Penumbra.GameData.Enums;
@ -44,6 +44,7 @@ public class Penumbra : IDalamudPlugin
public static bool DevPenumbraExists;
public static bool IsNotInstalledPenumbra;
public static Logger Log { get; private set; } = null!;
public static Configuration Config { get; private set; } = null!;
public static ResidentResourceManager ResidentResources { get; private set; } = null!;
@ -74,6 +75,7 @@ public class Penumbra : IDalamudPlugin
try
{
Dalamud.Initialize( pluginInterface );
Log = new Logger();
GameData.GameData.GetIdentifier( Dalamud.GameData );
DevPenumbraExists = CheckDevPluginPenumbra();
IsNotInstalledPenumbra = CheckIsNotInstalled();
@ -135,17 +137,17 @@ public class Penumbra : IDalamudPlugin
SubscribeItemLinks();
if( ImcExceptions > 0 )
{
PluginLog.Error( $"{ImcExceptions} IMC Exceptions thrown. Please repair your game files." );
Log.Error( $"{ImcExceptions} IMC Exceptions thrown. Please repair your game files." );
}
else
{
PluginLog.Information( $"Penumbra Version {Version}, Commit #{CommitHash} successfully Loaded." );
Log.Information( $"Penumbra Version {Version}, Commit #{CommitHash} successfully Loaded." );
}
Dalamud.PluginInterface.UiBuilder.Draw += _windowSystem.Draw;
OtterTex.NativeDll.Initialize( Dalamud.PluginInterface.AssemblyLocation.DirectoryName );
PluginLog.Information( $"Loading native OtterTex assembly from {OtterTex.NativeDll.Directory}." );
Log.Information( $"Loading native OtterTex assembly from {OtterTex.NativeDll.Directory}." );
}
catch
{
@ -261,7 +263,7 @@ public class Penumbra : IDalamudPlugin
.WithController( () => new ModsController( this ) )
.WithController( () => new RedrawController( this ) ) );
WebServer.StateChanged += ( _, e ) => PluginLog.Information( $"WebServer New State - {e.NewState}" );
WebServer.StateChanged += ( _, e ) => Log.Information( $"WebServer New State - {e.NewState}" );
WebServer.RunAsync();
}
@ -515,7 +517,7 @@ public class Penumbra : IDalamudPlugin
}
catch( Exception e )
{
PluginLog.Error( $"Could not check for dev plugin Penumbra:\n{e}" );
Log.Error( $"Could not check for dev plugin Penumbra:\n{e}" );
return true;
}
#else
@ -530,7 +532,7 @@ public class Penumbra : IDalamudPlugin
var checkedDirectory = Dalamud.PluginInterface.AssemblyLocation.Directory?.Parent?.Parent?.Name;
var ret = checkedDirectory?.Equals( "installedPlugins", StringComparison.OrdinalIgnoreCase ) ?? false;
if (!ret)
PluginLog.Error($"Penumbra is not correctly installed. Application loaded from \"{Dalamud.PluginInterface.AssemblyLocation.Directory!.FullName}\"." );
Log.Error($"Penumbra is not correctly installed. Application loaded from \"{Dalamud.PluginInterface.AssemblyLocation.Directory!.FullName}\"." );
return !ret;
#else
return false;