2022-08-30 15:00:58 +00:00
|
|
|
|
using System;
|
2022-08-30 15:05:29 +00:00
|
|
|
|
using System.Collections.Generic;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace SharpChat {
|
|
|
|
|
public static class Logger {
|
2022-08-30 15:05:29 +00:00
|
|
|
|
public static void Write()
|
|
|
|
|
=> Console.WriteLine();
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
2022-08-30 15:05:29 +00:00
|
|
|
|
[Conditional(@"DEBUG")]
|
|
|
|
|
public static void Debug()
|
|
|
|
|
=> Write();
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
2022-08-30 15:05:29 +00:00
|
|
|
|
public static void Write(string str)
|
|
|
|
|
=> Console.WriteLine(string.Format(@"[{1}] {0}", str, DateTime.Now));
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
|
|
|
|
[Conditional(@"DEBUG")]
|
|
|
|
|
public static void Debug(string str)
|
|
|
|
|
=> Write(str);
|
|
|
|
|
|
2022-08-30 15:05:29 +00:00
|
|
|
|
public static void Write(byte[] bytes)
|
|
|
|
|
=> Write(Encoding.UTF8.GetString(bytes));
|
|
|
|
|
|
2022-08-30 15:00:58 +00:00
|
|
|
|
[Conditional(@"DEBUG")]
|
|
|
|
|
public static void Debug(byte[] bytes)
|
|
|
|
|
=> Write(bytes);
|
|
|
|
|
|
2022-08-30 15:05:29 +00:00
|
|
|
|
public static void Write(object obj)
|
|
|
|
|
=> Write(obj?.ToString() ?? string.Empty);
|
|
|
|
|
|
2022-08-30 15:00:58 +00:00
|
|
|
|
[Conditional(@"DEBUG")]
|
|
|
|
|
public static void Debug(object obj)
|
|
|
|
|
=> Write(obj);
|
2022-08-30 15:05:29 +00:00
|
|
|
|
|
|
|
|
|
public static void Write(IEnumerable<object> objs)
|
|
|
|
|
=> Write(string.Join(@", ", objs));
|
|
|
|
|
|
|
|
|
|
[Conditional(@"DEBUG")]
|
|
|
|
|
public static void Debug(IEnumerable<object> objs)
|
|
|
|
|
=> Write(objs);
|
2022-08-30 15:00:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|