Ejemplo n.º 1
0
        public static void LogError(Exception ex, string additionalString = null)
        {
            var thisException = ex;
            var message       = new StringBuilder(
                !string.IsNullOrEmpty(additionalString)
                                        ? $"{additionalString}{Environment.NewLine}"
                                        : string.Empty);

            message.Append($"{thisException.Message}{Environment.NewLine}{thisException.StackTrace}{Environment.NewLine}");

            while (thisException.InnerException != null)
            {
                thisException = thisException.InnerException;
                message.Append("--------------- INNER EXCEPTION ---------------");
                message.Append($"{Environment.NewLine}{thisException.Message.Replace(Environment.NewLine, " ")}{Environment.NewLine}{thisException.StackTrace}{Environment.NewLine}");
            }

            LogLineReceived?.Invoke(nameof(LogError), new LogLineReceivedEventArgs(message.ToString()));
        }
Ejemplo n.º 2
0
 public static void LogMessage(string message)
 {
     LogLineReceived?.Invoke(nameof(LogMessage), new LogLineReceivedEventArgs(message));
 }