summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-07-02 21:24:32 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-07-02 21:24:32 -0400
commit6a628a4d8a21b98a55ff29065980fc818d4f39dc (patch)
tree6a68e9e7065d21102600ac7921807b5f7f54dd2e /src/StardewModdingAPI/Framework
parent0e6d30f65b562704675a20b1c4ce399787a68511 (diff)
downloadSMAPI-6a628a4d8a21b98a55ff29065980fc818d4f39dc.tar.gz
SMAPI-6a628a4d8a21b98a55ff29065980fc818d4f39dc.tar.bz2
SMAPI-6a628a4d8a21b98a55ff29065980fc818d4f39dc.zip
simplify log timestamps in console (except in developer mode)
Diffstat (limited to 'src/StardewModdingAPI/Framework')
-rw-r--r--src/StardewModdingAPI/Framework/Monitor.cs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/StardewModdingAPI/Framework/Monitor.cs b/src/StardewModdingAPI/Framework/Monitor.cs
index 925efc33..b64b3b0b 100644
--- a/src/StardewModdingAPI/Framework/Monitor.cs
+++ b/src/StardewModdingAPI/Framework/Monitor.cs
@@ -45,6 +45,9 @@ namespace StardewModdingAPI.Framework
/// <summary>Whether SMAPI is aborting. Mods don't need to worry about this unless they have background tasks.</summary>
public bool IsExiting => this.ExitTokenSource.IsCancellationRequested;
+ /// <summary>Whether to show the full log stamps (with time/level/logger) in the console. If false, shows a simplified stamp with only the logger.</summary>
+ internal bool ShowFullStampInConsole { get; set; }
+
/// <summary>Whether to show trace messages in the console.</summary>
internal bool ShowTraceInConsole { get; set; }
@@ -124,7 +127,9 @@ namespace StardewModdingAPI.Framework
{
// generate message
string levelStr = level.ToString().ToUpper().PadRight(Monitor.MaxLevelLength);
- message = $"[{DateTime.Now:HH:mm:ss} {levelStr} {source}] {message}";
+
+ string fullMessage = $"[{DateTime.Now:HH:mm:ss} {levelStr} {source}] {message}";
+ string consoleMessage = this.ShowFullStampInConsole ? fullMessage : $"[{source}] {message}";
// write to console
if (this.WriteToConsole && (this.ShowTraceInConsole || level != LogLevel.Trace))
@@ -136,17 +141,17 @@ namespace StardewModdingAPI.Framework
if (background.HasValue)
Console.BackgroundColor = background.Value;
Console.ForegroundColor = color;
- Console.WriteLine(message);
+ Console.WriteLine(consoleMessage);
Console.ResetColor();
}
else
- Console.WriteLine(message);
+ Console.WriteLine(consoleMessage);
});
}
// write to log file
if (this.WriteToFile)
- this.LogFile.WriteLine(message);
+ this.LogFile.WriteLine(fullMessage);
}
}
}