/// <summary> /// Logs a line to this logger. /// </summary> /// <param name="msg">The contents of this log.</param> /// <param name="type">The type of log.</param> public void Log(string msg, DiscoreLogLevel type) { if (type >= MinimumLevel) { if (!string.IsNullOrWhiteSpace(Prefix)) { // Prefix msg = $"[{Prefix}] {msg}"; } try { OnLog?.Invoke(this, new DiscoreLogEventArgs(new DiscoreLogMessage(msg, type, DateTime.Now))); } // Log methods need to be guaranteed to never throw exceptions. catch { } } }
internal DiscoreLogMessage(string content, DiscoreLogLevel type, DateTime timestamp) { Content = content; Type = type; Timestamp = timestamp; }