public static void QueueLogObject(StackifyLib.Models.LogMsg msg) { try { if (PrefixEnabled() || _LogClient.CanQueue()) { if (msg.Ex != null) { if (string.IsNullOrEmpty(msg.Level)) { msg.Level = "ERROR"; } string origMsg = msg.Msg; if (msg.Msg != null && msg.Ex != null) { msg.Msg += "\r\n" + msg.Ex.ToString(); } else if (msg.Msg == null && msg.Ex != null) { msg.Msg = msg.Ex.ToString(); } bool ignore = StackifyError.IgnoreError(msg.Ex); bool shouldSend = _LogClient.ErrorShouldBeSent(msg.Ex); if (!ignore) { if (!string.IsNullOrEmpty(origMsg)) { msg.Ex.SetAdditionalMessage(origMsg); } if (!shouldSend) { msg.Ex = null; msg.Msg += " #errorgoverned"; } } else { msg.Ex = null; } } _LogClient.QueueMessage(msg); } else { StackifyAPILogger.Log("Unable to send log because the queue is full"); } } catch (Exception ex) { StackifyAPILogger.Log(ex.ToString()); } }
public static void QueueLogObject(StackifyLib.Models.LogMsg msg, Exception exceptionObject) { if (exceptionObject != null) { msg.Ex = StackifyError.New(exceptionObject); } QueueLogObject(msg); }
public static void QueueException(StackifyError error) { var msg = new LogMsg() { Level = "ERROR", Msg = error.Message, Ex = error }; QueueLogObject(msg); }
/// <summary> /// Errors we don't want to log as exceptions to our API /// </summary> /// <param name="ex"></param> /// <returns></returns> public static bool IgnoreError(StackifyError ex) { bool ignore = false; try { //if (ex._Exception is System.Threading.ThreadAbortException) //{ // ignore = true; //} } catch (Exception) { } return(ignore); }
internal static bool ErrorShouldBeSent(StackifyError error) { return _LogClient.ErrorShouldBeSent(error); }
/// <summary> /// Errors we don't want to log as exceptions to our API /// </summary> /// <param name="ex"></param> /// <returns></returns> public static bool IgnoreError(StackifyError ex) { bool ignore = false; try { if (ex._Exception is System.Threading.ThreadAbortException) { ignore = true; } } catch (Exception) { } return ignore; }
internal static bool ErrorShouldBeSent(StackifyError error) { return(_LogClient.ErrorShouldBeSent(error)); }