public void Log(string content, LogSeverity logSeverity = LogSeverity.Information) { if (IsLoggingEnable) { try { #if NETFRAMEWORK var eventLog = new EventLog { Source = Source }; eventLog.WriteEntry(content, MapToEventLogType(logSeverity)); #endif } catch (Exception error) { OnFailedLogAttempt?.Invoke(this, error); } } }
public void LogError(string notes, Exception ex, LogSeverity logSeverity = LogSeverity.Error) { if (IsLoggingEnable) { try { #if NETFRAMEWORK var eventLog = new EventLog { Source = Source }; eventLog.WriteEntry(notes + ExceptionHelper.GetAllExceptionInfo(ex), MapToEventLogType(logSeverity)); #endif } catch (Exception error) { OnFailedLogAttempt?.Invoke(this, error); } } }