public FailureObjectLogEntry(IFailureObjectLoggable failureObject, string ex, string failureHash, string exType, Guid failureGuid = default(Guid), int failureLevel = 0) { this.FailureObject = failureObject; this.FailureException = ex; this.FailureExceptionHash = failureHash; this.FailureExceptionType = exType; this.FailureGuid = ((failureGuid == default(Guid)) ? Guid.NewGuid() : failureGuid); this.FailureLevel = failureLevel; }
public void LogFailureEvent(IFailureObjectLoggable failureObject, Exception failureException) { if (failureException != null && failureObject != null) { FailureObjectLog.FailureObjectLogEntry failureObjectLogEntry = new FailureObjectLog.FailureObjectLogEntry(failureObject, this.ExtractExceptionString(failureException), this.ComputeFailureHash(failureException), failureException.GetType().Name, default(Guid), 0); this.failureLogger.LogObject(failureObjectLogEntry); while (failureException.InnerException != null) { failureException = failureException.InnerException; failureObjectLogEntry = new FailureObjectLog.FailureObjectLogEntry(failureObject, this.ExtractExceptionString(failureException), this.ComputeFailureHash(failureException), failureException.GetType().Name, failureObjectLogEntry.FailureGuid, failureObjectLogEntry.FailureLevel + 1); this.failureLogger.LogObject(failureObjectLogEntry); } } }
public static void LogCommonFailureEvent(IFailureObjectLoggable failureEvent, Exception failureException) { CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; CultureInfo currentUICulture = Thread.CurrentThread.CurrentUICulture; try { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; CommonFailureLog.instance.LogFailureEvent(failureEvent, failureException); } finally { Thread.CurrentThread.CurrentCulture = currentCulture; Thread.CurrentThread.CurrentUICulture = currentUICulture; } }