summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-11-26 16:00:02 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-11-26 16:00:02 -0500
commit7bea3c2ba00789a38ae71035548c2c6b5c298d5b (patch)
tree60c921655c84fb893c400692230dd8198820d7bd /src/StardewModdingAPI
parente9fee3f6fe18927192b1dd676cd420507af2e389 (diff)
downloadSMAPI-7bea3c2ba00789a38ae71035548c2c6b5c298d5b.tar.gz
SMAPI-7bea3c2ba00789a38ae71035548c2c6b5c298d5b.tar.bz2
SMAPI-7bea3c2ba00789a38ae71035548c2c6b5c298d5b.zip
add log entry when preprocessing an assembly (#166)
Diffstat (limited to 'src/StardewModdingAPI')
-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;
}