Example #1
0
 public JSONDiffRow(JSONProblem problemType, JSONWarnLevel warnLevel, string message, Exception ex = null)
 {
     ProblemType = problemType;
     WarnLevel = warnLevel;
     Message = message;
     Exception = ex?.ToString();
 }
 public void Trace(string source, string message, Exception exception)
 {
     if (this.IsTraceEnabled)
     {
         this.Trace(source, message, exception?.ToString() ?? string.Empty);
     }
 }
 public void Debug(string source, string message, Exception exception)
 {
     if (this.IsDebugEnabled)
     {
         this.Debug(source, message, exception?.ToString() ?? string.Empty);
     }
 }
Example #4
0
        public MoveResult(string sourceKey, string destKey, Exception e, string errorMsg = null)
            : this(sourceKey, destKey) {
            Contract.NotNull(e, nameof(e));

            this.SourceKey = sourceKey;
            this.DestKey = destKey;
            this.Exception = e;
            this.errorMsg = errorMsg ?? e?.ToString();
            this.Success = false;
        }
 public void Log(LogLevel logLevel, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
 {
     string message = String.Format(CultureInfo.InvariantCulture,
         "Provider: {0}" + Environment.NewLine +
         "Log level: {1}" + Environment.NewLine +
         "Event id: {2}" + Environment.NewLine +
         "Exception: {3}" + Environment.NewLine +
         "Message: {4}", _name, logLevel, eventId, exception?.ToString(), formatter(state, exception));
     _factory._log.AppendLine(message);
 }
Example #6
0
        protected LogEntry CreateLogEntry(string message, LogOperations LogOperation, Exception ex = null)
        {
            var result = new LogEntry(Request.UserHostAddress,
                User.Identity.Name,
                message,
                LogOperation.ToString(),
                ex?.ToString());

            return result;
        }
Example #7
0
 private void CallLogger(LogLevel level, object message, Exception exception = null)
 {
     switch (level)
     {
         case LogLevel.Debug:
             Trace.WriteLine($"DEBUG - {message}, {exception?.ToString() ?? "(null)"}");
             if (logger.IsDebugEnabled)
             {
                 logger.Debug(message, exception);
             }
             return;
         case LogLevel.Error:
             Trace.WriteLine($"ERROR - {message}, {exception?.ToString() ?? "(null)"}");
             if (logger.IsErrorEnabled)
             {
                 logger.Error(message, exception);
             }
             return;
         case LogLevel.Fatal:
             Trace.WriteLine($"FATAL - {message}, {exception?.ToString() ?? "(null)"}");
             if (logger.IsFatalEnabled)
             {
                 logger.Fatal(message, exception);
             }
             return;
         case LogLevel.Info:
             Trace.WriteLine($"INFO - {message}, {exception?.ToString() ?? "(null)"}");
             if (logger.IsInfoEnabled)
             {
                 logger.Info(message, exception);
             }
             return;
         default:
             Trace.WriteLine($"WARN - {message}, {exception?.ToString() ?? "(null)"}");
             if (logger.IsWarnEnabled)
             {
                 logger.Warn(message, exception);
             }
             return;
     }
 }
 private IActionResult ErrorResponse(int error, string serviceId = null, Exception ex = null)
 {
     var s = errors[error];
     return JilJsonResult.CreateWithStatusCode(new
     {
         error = new
         {
             code = error,
             message = s.Message,
             exception = ex?.ToString()
         }
     }, s.StatusCode);
 }
Example #9
0
        async Task Write(string phase, object e, Exception ex = null)
        {
            var s = new XmlSerializer(e.GetType());
            var w = new StringWriter();
            s.Serialize(w, e);            

            _context.Entries.Create(new LogEntryData
            {
                LoggedAt = _clock.Time,
                UserId = _authenticator.UserId,
                Text = phase + " " + e,
                Error = ex?.ToString(),
                Xml = w.ToString()
            });

            await _context.SaveAsync();
        }
 internal void Warning(string message, Exception exception)
 {
     if (IsWarningEnabled)
         Warning(message, exception?.ToString() ?? string.Empty);
 }
Example #11
0
 public void Info(string source, string message, Exception exception)
 {
     if (this.IsInfoEnabled)
     {
         this.Info(source, message, exception?.ToString() ?? string.Empty);
     }
 }
Example #12
0
 /// <summary>
 /// Показать ошибку на экране.
 /// </summary>
 /// <param name="ex">Ошибка.</param>
 /// <returns>Результат.</returns>
 public static async Task ShowFullError(Exception ex)
 {
     var dialog = new ErrorInfoDialog();
     dialog.Error = ex?.ToString() ?? "";
     await dialog.ShowAsync();
 }
Example #13
0
 public void Error(string source, string message, Exception exception)
 {
     if (this.IsErrorEnabled)
     {
         this.Error(source, message, exception?.ToString() ?? string.Empty);
     }
 }
		/// <summary>
		/// Logs the error.
		/// </summary>
		/// <param name="sender">Sender.</param>
		/// <param name="ex">Ex.</param>
		/// <param name="message">Message.</param>
		public void LogError(object sender, Exception ex = null, string message = null)
		{
			Debug.WriteLine(string.Format("ERROR {0}: {1}{2}{3}", sender?.GetType()?.Name, message, Environment.NewLine, ex?.ToString()));
		}
 public void Error(string message, Exception exception, string scope) => this.Error(message, exception?.ToString() ?? string.Empty, scope);
 public void Warning(string message, Exception exception) => this.Warning(message, exception?.ToString() ?? string.Empty);
Example #17
0
 public void Error(string msg, Exception ex = null)
 {
     _form.Invoke((MethodInvoker)delegate {
         _form.richTextBox1.SelectionColor = Color.Red;
         _form.richTextBox1.AppendText($"{msg}\n");
         _form.richTextBox1.SelectionColor = Color.Gray;
         _form.richTextBox1.AppendText($"{ex?.ToString()}\n");
     });
 }
Example #18
0
		static void ShowException(Exception ex) {
			string msg = ex?.ToString() ?? "Unknown exception";
			MessageBox.Show(msg, "dnSpy", MessageBoxButton.OK, MessageBoxImage.Error);
		}
 internal void Error(string message, Exception exception)
 {
     if (IsErrorEnabled)
         Error(message, exception?.ToString() ?? string.Empty);
 }
Example #20
0
        private static void UnhandledExceptionHandler(Exception e) {
            var text = e?.ToString() ?? @"?";

            if (!LogError(text)) {
                try {
                    var logFilename = $"{AppDomain.CurrentDomain.BaseDirectory}/content_manager_crash_{DateTime.Now.Ticks}.txt";
                    File.WriteAllText(logFilename, text);
                } catch (Exception) {
                    // ignored
                }
            }

            try {
                UnhandledExceptionFancyHandler(e);
                return;
            } catch (Exception ex) {
                LogError(ex.Message);

                try {
                    MessageBox.Show(text, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                } catch (Exception) {
                    // ignored
                }
            }

            Environment.Exit(1);
        }
 public void Error(string message, Exception exception) => this.Error(message, exception?.ToString() ?? string.Empty);
 public void Warning(string message, Exception exception, string scope) => this.Warning(message, exception?.ToString() ?? string.Empty, scope);