summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-02-11 02:08:21 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-02-11 02:08:21 -0500
commit693f16f99ec3492e3bfcd0071af1d9d5e519dcfa (patch)
tree394c9001905670b2a86c106289ea0ef9b6ac09ab /src
parent824ca7174a2b6a46d8a4ea50cac41c78e56dc48f (diff)
downloadSMAPI-693f16f99ec3492e3bfcd0071af1d9d5e519dcfa.tar.gz
SMAPI-693f16f99ec3492e3bfcd0071af1d9d5e519dcfa.tar.bz2
SMAPI-693f16f99ec3492e3bfcd0071af1d9d5e519dcfa.zip
don't write direct console output to log file (#233)
Per discussion with mod developers.
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI/Framework/Monitor.cs10
-rw-r--r--src/StardewModdingAPI/Program.cs6
2 files changed, 12 insertions, 4 deletions
diff --git a/src/StardewModdingAPI/Framework/Monitor.cs b/src/StardewModdingAPI/Framework/Monitor.cs
index 33c1bbf4..3a9276a0 100644
--- a/src/StardewModdingAPI/Framework/Monitor.cs
+++ b/src/StardewModdingAPI/Framework/Monitor.cs
@@ -44,6 +44,9 @@ namespace StardewModdingAPI.Framework
/// <summary>Whether to write anything to the console. This should be disabled if no console is available.</summary>
internal bool WriteToConsole { get; set; } = true;
+ /// <summary>Whether to write anything to the log file. This should almost always be enabled.</summary>
+ internal bool WriteToFile { get; set; } = true;
+
/*********
** Public methods
@@ -116,7 +119,7 @@ namespace StardewModdingAPI.Framework
string levelStr = level.ToString().ToUpper().PadRight(Monitor.MaxLevelLength);
message = $"[{DateTime.Now:HH:mm:ss} {levelStr} {source}] {message}";
- // log
+ // write to console
if (this.WriteToConsole && (this.ShowTraceInConsole || level != LogLevel.Trace))
{
this.ConsoleManager.ExclusiveWriteWithoutInterception(() =>
@@ -131,7 +134,10 @@ namespace StardewModdingAPI.Framework
Console.WriteLine(message);
});
}
- this.LogFile.WriteLine(message);
+
+ // write to log file
+ if (this.WriteToFile)
+ this.LogFile.WriteLine(message);
}
}
}
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 91a39042..f4518e21 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -112,8 +112,10 @@ namespace StardewModdingAPI
// redirect direct console output
{
- IMonitor monitor = Program.GetSecondaryMonitor("Console.Out");
- Program.ConsoleManager.OnLineIntercepted += line => monitor.Log(line, LogLevel.Trace);
+ Monitor monitor = Program.GetSecondaryMonitor("Console.Out");
+ monitor.WriteToFile = false; // not useful for troubleshooting mods per discussion
+ if (monitor.WriteToConsole)
+ Program.ConsoleManager.OnLineIntercepted += line => monitor.Log(line, LogLevel.Trace);
}
// add warning headers