summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI/Framework/ModAssemblyLoader.cs9
-rw-r--r--src/StardewModdingAPI/Program.cs6
2 files changed, 11 insertions, 4 deletions
diff --git a/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs b/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs
index 6c0f0cdf..f367c6a0 100644
--- a/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs
+++ b/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs
@@ -16,15 +16,20 @@ namespace StardewModdingAPI.Framework
/// <summary>The directory in which to cache data.</summary>
private readonly string CacheDirPath;
+ /// <summary>Encapsulates monitoring and logging for a given module.</summary>
+ private readonly IMonitor Monitor;
+
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="cacheDirPath">The cache directory.</param>
- public ModAssemblyLoader(string cacheDirPath)
+ /// <param name="monitor">Encapsulates monitoring and logging for a given module.</param>
+ public ModAssemblyLoader(string cacheDirPath, IMonitor monitor)
{
this.CacheDirPath = cacheDirPath;
+ this.Monitor = monitor;
}
/// <summary>Preprocess an assembly and cache the modified version.</summary>
@@ -42,6 +47,8 @@ namespace StardewModdingAPI.Framework
// process assembly if not cached
if (!canUseCache)
{
+ this.Monitor.Log($"Preprocessing new assembly {assemblyPath}...");
+
// read assembly definition
AssemblyDefinition definition;
using (Stream readStream = new MemoryStream(assemblyBytes))
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index f8920896..e364ef03 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -298,7 +298,7 @@ namespace StardewModdingAPI
{
Program.Monitor.Log("Loading mods...");
- ModAssemblyLoader modAssemblyLoader = new ModAssemblyLoader(Program.CachePath);
+ ModAssemblyLoader modAssemblyLoader = new ModAssemblyLoader(Program.CachePath, Program.Monitor);
foreach (string directory in Directory.GetDirectories(Program.ModPath))
{
// ignore internal directory
@@ -403,7 +403,7 @@ namespace StardewModdingAPI
}
catch (Exception ex)
{
- Program.Monitor.Log($"{errorPrefix}: an error occurred while preprocessing '{assemblyPath}'.\n{ex}", LogLevel.Error);
+ Program.Monitor.Log($"{errorPrefix}: an error occurred while preprocessing '{Path.GetFileName(assemblyPath)}'.\n{ex.GetLogSummary()}", LogLevel.Error);
succeeded = false;
break;
}
@@ -426,7 +426,7 @@ namespace StardewModdingAPI
}
catch (Exception ex)
{
- Program.Monitor.Log($"{errorPrefix}: an error occurred while optimising the target DLL.\n{ex}", LogLevel.Error);
+ Program.Monitor.Log($"{errorPrefix}: an error occurred while optimising the target DLL.\n{ex.GetLogSummary()}", LogLevel.Error);
continue;
}