blob: ffef7cefafe5b219bbadbb3e5d43388c5dabb7fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
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; }
/// <summary>Whether the message should be printed to the console.</summary>
internal bool PrintConsole { 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");
this.Colour = color;
this.PrintConsole = true;
}
}
}
|