in Configurator/Core/Logging/Logger.cs [278:336]
public static void LogException(Exception exception, bool displayOnUserInterface = false, string errorMessage = null, string errorTitle = null, bool unhandled = false, bool useInnerException = true)
{
if (exception == null
|| !Initialized)
{
return;
}
var emptyErrorMessage = string.IsNullOrEmpty(errorMessage);
var emptyErrorTitle = string.IsNullOrEmpty(errorTitle);
if (!displayOnUserInterface
&& emptyErrorMessage
&& emptyErrorTitle)
{
LogExceptionSimple(exception, unhandled, useInnerException);
return;
}
if (emptyErrorTitle)
{
errorTitle = unhandled
? Resources.UnhandledExceptionText
: Resources.ErrorText;
}
var callingMethod = new StackFrame(1).GetMethod();
var declaringType = callingMethod.DeclaringType;
var shownException = useInnerException && exception.InnerException != null ? exception.InnerException : exception;
var message = string.Format(Resources.ApplicationExceptionWithCustomMessageForLog,
emptyErrorMessage ? (unhandled ? Resources.UnhandledExceptionText : Resources.ApplicationExceptionText) : errorMessage,
declaringType?.Name ?? "Unknown",
callingMethod.Name,
shownException.Message);
var traceEventType = unhandled ? TraceEventType.Critical : TraceEventType.Error;
LogEvent(traceEventType, unhandled ? 100 : 50, message, false);
if (!displayOnUserInterface)
{
return;
}
if (!ConsoleMode)
{
string exceptionMoreInfo = string.Format(Resources.ApplicationExceptionForMoreInfo, declaringType?.Name ?? "Unknown", callingMethod.Name, shownException.Message, shownException.StackTrace);
var infoProperties = InfoDialogProperties.GetErrorDialogProperties(errorTitle, errorMessage, shownException.Message, exceptionMoreInfo);
infoProperties.FitTextStrategy = InfoDialog.FitTextsAction.IncreaseDialogWidth;
infoProperties.WordWrapMoreInfo = false;
if (ErrorDialogAutoCloseSeconds > 0)
{
infoProperties.CommandAreaProperties.DefaultButton = InfoDialog.DefaultButtonType.Button1;
infoProperties.CommandAreaProperties.DefaultButtonTimeout = ErrorDialogAutoCloseSeconds;
}
InfoDialog.ShowDialog(infoProperties);
}
else
{
Console.WriteLine($@"{traceEventType} : message");
}
}