sharp-chat/SharpChat/Logger.cs

35 lines
825 B
C#
Raw Normal View History

2022-08-30 15:00:58 +00:00
using System;
using System.Diagnostics;
using System.Text;
namespace SharpChat {
public static class Logger {
2023-02-07 15:01:56 +00:00
public static void Write(string str) {
Console.WriteLine(string.Format("[{1}] {0}", str, DateTime.Now));
2023-02-07 15:01:56 +00:00
}
2022-08-30 15:00:58 +00:00
2023-02-07 15:01:56 +00:00
public static void Write(byte[] bytes) {
Write(Encoding.UTF8.GetString(bytes));
}
2022-08-30 15:00:58 +00:00
2023-02-07 15:01:56 +00:00
public static void Write(object obj) {
Write(obj?.ToString() ?? string.Empty);
}
2022-08-30 15:00:58 +00:00
[Conditional("DEBUG")]
2023-02-07 15:01:56 +00:00
public static void Debug(string str) {
Write(str);
}
2022-08-30 15:00:58 +00:00
[Conditional("DEBUG")]
2023-02-07 15:01:56 +00:00
public static void Debug(byte[] bytes) {
Write(bytes);
}
2022-08-30 15:00:58 +00:00
[Conditional("DEBUG")]
2023-02-07 15:01:56 +00:00
public static void Debug(object obj) {
Write(obj);
}
2022-08-30 15:00:58 +00:00
}
}