/// <summary> /// Adds an entry with the given arguments to the error log. /// </summary> /// <param name="logEntryType">Log entry type</param> /// <param name="pluginName">Name of the bundle that is the source of the log entry</param> /// <param name="message">Log entry message</param> /// <param name="exception">Log entry exception</param> public void Add(ELogEntryType logEntryType, string pluginName, string message, Exception exception) { if (exception == null && string.IsNullOrEmpty(message)) { throw new ArgumentException("An exception or a message must be given"); } ErrorLogEntry errorLogEntry = new ErrorLogEntry(logEntryType, message ?? exception.Message, exception, pluginName); // TODO Write error log entry into a file // Log entry if (logEntryType == ELogEntryType.Error) { _log.Error(errorLogEntry.Message + $" ({pluginName})", errorLogEntry.Exception); } else { _log.Warning(errorLogEntry.Message + $" ({pluginName})", errorLogEntry.Exception); } // Dispatch event Added.Dispatch(new object[] { this, errorLogEntry }, OnDispatchError); }