コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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);
                }
            }
        }