summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/LogInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/LogInfo.cs')
-rw-r--r--src/StardewModdingAPI/LogInfo.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/LogInfo.cs b/src/StardewModdingAPI/LogInfo.cs
new file mode 100644
index 00000000..f0f08e4f
--- /dev/null
+++ b/src/StardewModdingAPI/LogInfo.cs
@@ -0,0 +1,40 @@
+using System;
+
+namespace StardewModdingAPI
+{
+ /// <summary>A message queued for log output.</summary>
+ public struct LogInfo
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The message to log.</summary>
+ public string Message { get; set; }
+
+ /// <summary>The log date.</summary>
+ public string LogDate { get; set; }
+
+ /// <summary>The log time.</summary>
+ public string LogTime { get; set; }
+
+ /// <summary>The message color.</summary>
+ public ConsoleColor Colour { get; set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="message">The message to log.</param>
+ /// <param name="color">The message color.</param>
+ public LogInfo(string message, ConsoleColor color = ConsoleColor.Gray)
+ {
+ if (string.IsNullOrEmpty(message))
+ message = "[null]";
+ this.Message = message;
+ this.LogDate = DateTime.Now.ToString("yyyy-MM-dd");
+ this.LogTime = DateTime.Now.ToString("hh:mm:ss.fff tt");
+ this.Colour = color;
+ }
+ }
+}