public static void LogError(Exception ex, string messageOrFormat, params object[] formatArgs) { var msg = new StringBuilder(); if (!formatArgs.IsNullOrEmpty()) { msg.AppendFormat(messageOrFormat, formatArgs); } else { msg.Append(messageOrFormat); } try { var process = Process.GetCurrentProcess(); msg.Insert(0, Environment.NewLine); msg.Insert(0, string.Format("[Process={0}:{1}]", process.Id, process.ProcessName)); if (_onLogError != null) { _onLogError(ex); } } catch (Exception ex2) { msg.AppendFormat("LogError Error:{0}", ex2.Message); } ExceptionLogger.Error(msg, ex); }
public void Exception(object message, Exception ex) { ExceptionLogger.Error(JsonConvert.SerializeObject(message), ex); }