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) {
|
2023-02-08 03:17:07 +00:00
|
|
|
|
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
|
|
|
|
|
2023-02-08 03:17:07 +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
|
|
|
|
|
2023-02-08 03:17:07 +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
|
|
|
|
|
2023-02-08 03:17:07 +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
|
|
|
|
}
|
|
|
|
|
}
|