summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/Monitor.cs
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/StardewModdingAPI/Framework/Monitor.cs
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/StardewModdingAPI/Framework/Monitor.cs')
-rw-r--r--src/StardewModdingAPI/Framework/Monitor.cs10
1 files changed, 8 insertions, 2 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);
}
}
}