diff options
Diffstat (limited to 'src/StardewModdingAPI/Framework/Monitor.cs')
-rw-r--r-- | src/StardewModdingAPI/Framework/Monitor.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/StardewModdingAPI/Framework/Monitor.cs b/src/StardewModdingAPI/Framework/Monitor.cs index cf46a474..0989bb7e 100644 --- a/src/StardewModdingAPI/Framework/Monitor.cs +++ b/src/StardewModdingAPI/Framework/Monitor.cs @@ -37,6 +37,9 @@ namespace StardewModdingAPI.Framework /// <summary>Whether to show trace messages in the console.</summary> internal bool ShowTraceInConsole { get; set; } + /// <summary>Whether to write anything to the console. This should be disabled if no console is available.</summary> + internal bool WriteToConsole { get; set; } = true; + /********* ** Public methods @@ -108,7 +111,7 @@ namespace StardewModdingAPI.Framework message = $"[{DateTime.Now:HH:mm:ss} {levelStr} {source}] {message}"; // log - if (this.ShowTraceInConsole || level != LogLevel.Trace) + if (this.WriteToConsole && (this.ShowTraceInConsole || level != LogLevel.Trace)) { Console.ForegroundColor = color; Console.WriteLine(message); |