示例#1
0
        public static void QueueLogObject(StackifyLib.Models.LogMsg msg)
        {
            try
            {
                if (_LogClient.CanQueue())
                {

                    if (msg.Ex != null)
                    {
                        if (!StackifyError.IgnoreError(msg.Ex) && _LogClient.ErrorShouldBeSent(msg.Ex))
                        {
                            if (!string.IsNullOrEmpty(msg.Msg))
                            {
                                msg.Ex.SetAdditionalMessage(msg.Msg);
                            }

                            msg.Msg = msg.Ex.ToString();
                        }
                        else
                        {
                            msg.Msg += " #errorgoverned";
                        }

                        if (string.IsNullOrEmpty(msg.Level))
                        {
                            msg.Level = "ERROR";
                        }
                    }

                    _LogClient.QueueMessage(msg);
                }
                else
                {
                    StackifyAPILogger.Log("Unable to send log because the queue is full");
                }

            }
            catch (Exception ex)
            {
                StackifyAPILogger.Log(ex.ToString());
            }
        }
示例#2
0
        public static void QueueLogObject(StackifyLib.Models.LogMsg msg, Exception exceptionObject)
        {
            if (exceptionObject != null)
            {
                msg.Ex = StackifyError.New(exceptionObject);
            }

            QueueLogObject(msg);
        }
示例#3
0
        public static void QueueLogObject(StackifyLib.Models.LogMsg msg)
        {
            try
            {
                if (_LogClient.CanQueue() || SasquatchEnabled())
                {

                    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());
            }
        }