Use DateTime format for clock stamp
Replace verbose StringBuilder-based timestamp construction with a single DateTime format string. The method now returns the clock stamp using the format "[{DateTime.Now:dd-MM-yy HH:mm}] ", simplifying the code and improving readability while preserving the original output layout.
for issue 121
This commit is contained in:
parent
4133496775
commit
d77a7f0f62
1 changed files with 2 additions and 16 deletions
|
|
@ -56,22 +56,8 @@ namespace SecondBotEvents
|
||||||
|
|
||||||
public static string GetClockStamp()
|
public static string GetClockStamp()
|
||||||
{
|
{
|
||||||
var date = DateTime.Now;
|
// Format: [dd-MM-yyyy HH:mm]
|
||||||
StringBuilder n = new();
|
return $"[{DateTime.Now:dd-MM-yy HH:mm}] ";
|
||||||
n.Append("[");
|
|
||||||
if (date.Hour < 10)
|
|
||||||
{
|
|
||||||
n.Append("0");
|
|
||||||
}
|
|
||||||
n.Append(date.Hour.ToString());
|
|
||||||
n.Append(":");
|
|
||||||
if (date.Minute < 10)
|
|
||||||
{
|
|
||||||
n.Append("0");
|
|
||||||
}
|
|
||||||
n.Append(date.Minute.ToString());
|
|
||||||
n.Append("] ");
|
|
||||||
return n.ToString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string Add(string message, ConsoleLogLogLevel Level, bool send_to_console = true)
|
private static string Add(string message, ConsoleLogLogLevel Level, bool send_to_console = true)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue