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

@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Linq;
using Dalamud.Logging;
namespace Penumbra.Mods;
@ -34,7 +33,7 @@ public partial class Mod
}
catch( Exception e )
{
PluginLog.Error( $"Could not delete empty directory {dir!.FullName} to move {mod.Name} to it:\n{e}" );
Penumbra.Log.Error( $"Could not delete empty directory {dir!.FullName} to move {mod.Name} to it:\n{e}" );
return;
}
@ -55,7 +54,7 @@ public partial class Mod
}
catch( Exception e )
{
PluginLog.Error( $"Could not move {mod.Name} from {oldDirectory.Name} to {dir!.Name}:\n{e}" );
Penumbra.Log.Error( $"Could not move {mod.Name} from {oldDirectory.Name} to {dir!.Name}:\n{e}" );
return;
}
@ -63,7 +62,7 @@ public partial class Mod
mod.ModPath = dir;
if( !mod.Reload( out var metaChange ) )
{
PluginLog.Error( $"Error reloading moved mod {mod.Name}." );
Penumbra.Log.Error( $"Error reloading moved mod {mod.Name}." );
return;
}
@ -81,10 +80,10 @@ public partial class Mod
var mod = this[ idx ];
var oldName = mod.Name;
ModPathChanged.Invoke(ModPathChangeType.StartingReload, mod, mod.ModPath, mod.ModPath );
ModPathChanged.Invoke( ModPathChangeType.StartingReload, mod, mod.ModPath, mod.ModPath );
if( !mod.Reload( out var metaChange ) )
{
PluginLog.Warning( mod.Name.Length == 0
Penumbra.Log.Warning( mod.Name.Length == 0
? $"Reloading mod {oldName} has failed, new name is empty. Deleting instead."
: $"Reloading mod {oldName} failed, {mod.ModPath.FullName} does not exist anymore or it ha. Deleting instead." );
@ -110,11 +109,11 @@ public partial class Mod
try
{
Directory.Delete( mod.ModPath.FullName, true );
PluginLog.Debug( "Deleted directory {Directory:l} for {Name:l}.", mod.ModPath.FullName, mod.Name );
Penumbra.Log.Debug( $"Deleted directory {mod.ModPath.FullName} for {mod.Name}.");
}
catch( Exception e )
{
PluginLog.Error( $"Could not delete the mod {mod.ModPath.Name}:\n{e}" );
Penumbra.Log.Error( $"Could not delete the mod {mod.ModPath.Name}:\n{e}" );
}
}
@ -125,7 +124,7 @@ public partial class Mod
--remainingMod.Index;
}
PluginLog.Debug( "Deleted mod {Name:l}.", mod.Name );
Penumbra.Log.Debug( $"Deleted mod {mod.Name}." );
}
// Load a new mod and add it to the manager if successful.
@ -145,7 +144,7 @@ public partial class Mod
mod.Index = _mods.Count;
_mods.Add( mod );
ModPathChanged.Invoke( ModPathChangeType.Added, mod, null, mod.ModPath );
PluginLog.Debug( "Added new mod {Name:l} from {Directory:l}.", mod.Name, modFolder.FullName );
Penumbra.Log.Debug( $"Added new mod {mod.Name} from {modFolder.FullName}." );
}
public enum NewDirectoryState

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Dalamud.Logging;
using OtterGui;
using OtterGui.Filesystem;
using Penumbra.GameData.ByteString;
@ -201,7 +200,7 @@ public sealed partial class Mod
var group = mod._groups[ groupIdx ];
if( group.Count > 63 )
{
PluginLog.Error(
Penumbra.Log.Error(
$"Could not add option {option.Name} to {group.Name} for mod {mod.Name}, "
+ "since only up to 64 options are supported in one group." );
return;
@ -307,7 +306,7 @@ public sealed partial class Mod
{
if( message )
{
PluginLog.Warning( $"Could not name option {newName} because option with same filename {path} already exists." );
Penumbra.Log.Warning( $"Could not name option {newName} because option with same filename {path} already exists." );
}
return false;

View file

@ -1,6 +1,5 @@
using System;
using System.IO;
using Dalamud.Logging;
namespace Penumbra.Mods;
@ -53,7 +52,7 @@ public sealed partial class Mod
}
catch( Exception e )
{
PluginLog.Error( $"Could not create specified mod directory {newDir.FullName}:\n{e}" );
Penumbra.Log.Error( $"Could not create specified mod directory {newDir.FullName}:\n{e}" );
}
}
@ -68,8 +67,7 @@ public sealed partial class Mod
private static void OnModDirectoryChange( string newPath, bool _ )
{
PluginLog.Information( "Set new mod base directory from {OldDirectory:l} to {NewDirectory:l}.",
Penumbra.Config.ModDirectory, newPath );
Penumbra.Log.Information( $"Set new mod base directory from {Penumbra.Config.ModDirectory} to {newPath}." );
Penumbra.Config.ModDirectory = newPath;
Penumbra.Config.Save();
}
@ -98,7 +96,7 @@ public sealed partial class Mod
}
ModDiscoveryFinished?.Invoke();
PluginLog.Information( "Rediscovered mods." );
Penumbra.Log.Information( "Rediscovered mods." );
if( MigrateModBackups )
{