示例#1
0
        public static void AlertOrLogException(string alertMessage, string alertKey = null, TimeSpan?alertIntervalOverride = null)
        {
            if (AlertsManager.ShouldSendAlert(alertKey ?? alertMessage, alertIntervalOverride))
            {
                Logger <IRestProtocolHeadLogger> .Instance.Critical.Log(alertMessage);

                return;
            }
            Logger <IRestProtocolHeadLogger> .Instance.Error.Log(alertMessage);
        }
示例#2
0
        public static void XEventOrLogError(string xEventMessage = null, string xEventKey = null, TimeSpan?xEventIntervalOverride = null)
        {
            if (AlertsManager.ShouldSendAlert(xEventKey ?? xEventMessage, xEventIntervalOverride))
            {
                Logger <IRestProtocolHeadLogger> .Instance.Event.Log(xEventMessage);

                return;
            }
            Logger <IRestProtocolHeadLogger> .Instance.Error.Log(xEventMessage);
        }
示例#3
0
        public static void AlertOrLogException(Exception e, string alertMessage = null, string alertKey = null, TimeSpan?alertIntervalOverride = null)
        {
            if (AlertsManager.ShouldAlertForException(e))
            {
                if (AlertsManager.ShouldSendAlert(alertKey ?? e.GetType().ToString(), alertIntervalOverride))
                {
                    IStringDataEventStream critical = Logger <IRestProtocolHeadLogger> .Instance.Critical;
                    object[] objArray = new object[] { alertMessage ?? "[FEUnhandledException] An unexpected non-fatal exception was encountered", e.ToString() };
                    critical.Log("{0}: {1}", objArray);
                    return;
                }
            }
            IStringDataEventStream error = Logger <IRestProtocolHeadLogger> .Instance.Error;

            object[] objArray1 = new object[] { alertMessage ?? "[FEUnhandledException] An unexpected non-fatal exception was encountered", e.ToString() };
            error.Log("{0}: {1}", objArray1);
        }