From 18e5e42529e13f21553651014a93c0f48cd93a59 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 3 Jul 2017 14:26:45 -0400 Subject: defer some console changes until SMAPI 2.0 --- src/StardewModdingAPI/Framework/Monitor.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/StardewModdingAPI/Framework') diff --git a/src/StardewModdingAPI/Framework/Monitor.cs b/src/StardewModdingAPI/Framework/Monitor.cs index 64cc0bdc..6359b454 100644 --- a/src/StardewModdingAPI/Framework/Monitor.cs +++ b/src/StardewModdingAPI/Framework/Monitor.cs @@ -45,8 +45,10 @@ namespace StardewModdingAPI.Framework /// Whether SMAPI is aborting. Mods don't need to worry about this unless they have background tasks. public bool IsExiting => this.ExitTokenSource.IsCancellationRequested; +#if SMAPI_2_0 /// Whether to show the full log stamps (with time/level/logger) in the console. If false, shows a simplified stamp with only the logger. internal bool ShowFullStampInConsole { get; set; } +#endif /// Whether to show trace messages in the console. internal bool ShowTraceInConsole { get; set; } @@ -95,6 +97,7 @@ namespace StardewModdingAPI.Framework this.ExitTokenSource.Cancel(); } +#if SMAPI_2_0 /// Write a newline to the console and log file. internal void Newline() { @@ -103,6 +106,7 @@ namespace StardewModdingAPI.Framework if (this.WriteToFile) this.LogFile.WriteLine(""); } +#endif #if !SMAPI_2_0 /// Log a message for the player or developer, using the specified console color. @@ -140,7 +144,11 @@ namespace StardewModdingAPI.Framework string levelStr = level.ToString().ToUpper().PadRight(Monitor.MaxLevelLength); string fullMessage = $"[{DateTime.Now:HH:mm:ss} {levelStr} {source}] {message}"; +#if SMAPI_2_0 string consoleMessage = this.ShowFullStampInConsole ? fullMessage : $"[{source}] {message}"; +#else + string consoleMessage = fullMessage; +#endif // write to console if (this.WriteToConsole && (this.ShowTraceInConsole || level != LogLevel.Trace)) -- cgit