using InABox.Core; namespace InABox.Logging; public abstract class LoggerBase { public LogType[] LogTypes = { LogType.Information, LogType.Query, LogType.Update, LogType.Error, LogType.Important }; protected abstract void DoSend(string message); public virtual void Send(LogType logType, string user, string message, Guid transaction) { if (!LogTypes.Any(x => x == logType)) return; var type = logType switch { LogType.Information => "INFO", LogType.Query => "READ", LogType.Update => "UPDATE", LogType.Error => "ERROR", LogType.Important => "IMPTNT", _ => "ERROR" }; var msg = string.Format("{0:HH:mm:ss.fff} {1} {2} {3} {4}", DateTime.Now, transaction, type?.PadRight(6), (user ?? "").PadRight(12), message ); DoSend(msg); } public virtual void Stop() { } }