Example #1
0
        public static void MssRegex_Search(HeContext heContext, string inParamText, string inParamPattern, bool inParamIgnoreCase, bool inParamMultiLine, bool inParamSingleLine, out bool outParamFound, out string outParamPatternResult, out int outParamFirstIndex)
        {
            DateTime startTime  = DateTime.Now;
            String   errorLogId = "";

            try {
                issText.MssRegex_Search(inParamText, inParamPattern, inParamIgnoreCase, inParamMultiLine, inParamSingleLine, out outParamFound, out outParamPatternResult, out outParamFirstIndex);
            } catch (Exception ex) {
                errorLogId = ErrorLog.LogApplicationError(ex, heContext, "Extension method execution: Text.Regex_Search");
                throw ex;
            } finally {
                if (errorLogId != string.Empty || (!heContext.AppInfo.SelectiveLoggingEnabled ||
                                                   (heContext.AppInfo.ExtensionProperties.AllowLogging("b69aa077-acf4-4bdc-bcd5-9def81d7ddcd") && heContext.AppInfo.Properties.AllowLogging)))
                {
                    int extLogCount = heContext.ExtensionLogCount;
                    if (extLogCount == _maxExtensionLogsPerRequest)
                    {
                        // issue warning
                        GeneralLog.StaticWrite(
                            DateTime.Now, heContext.Session.SessionID, heContext.AppInfo.eSpaceId, heContext.AppInfo.Tenant.Id,
                            heContext.Session.UserId, "The maximum number (" + _maxExtensionLogsPerRequest + ") of allowed Extension Log entries per request has been exceeded. No more entries will be logged in this request.",
                            "WARNING", "SLOWEXTENSION", "");
                        heContext.ExtensionLogCount = extLogCount + 1;
                    }
                    else if (extLogCount < _maxExtensionLogsPerRequest)
                    {
                        DateTime instant           = DateTime.Now;
                        int      executionDuration = Convert.ToInt32(DateTime.Now.Subtract(startTime).TotalMilliseconds);
                        ExtensionLog.StaticWrite(heContext.AppInfo, heContext.Session,
                                                 instant, executionDuration, "Regex_Search", errorLogId, 20, "Text");
                        heContext.ExtensionLogCount = extLogCount + 1;
                        RequestTracer reqTracer = heContext.RequestTracer;
                        if (reqTracer != null)
                        {
                            reqTracer.RegisterExtensionExecuted("5c204ebc-821d-48a8-aa5f-b3412dcd2696", "Regex_Search", "794c445f-f27d-4f61-b47a-0da71440df68", "ContactManager", executionDuration, instant);
                        }
                    }
                }
                RuntimePlatformUtils.LogSlowExtensionCall(startTime, "Text.Regex_Search");
            }
        }
Example #2
0
        public static void MssStringBuilder_Create(HeContext heContext, int inParamInitialCapacity, out object outParamStringBuilder)
        {
            DateTime startTime  = DateTime.Now;
            String   errorLogId = "";

            try {
                issText.MssStringBuilder_Create(inParamInitialCapacity, out outParamStringBuilder);
            } catch (Exception ex) {
                errorLogId = ErrorLog.LogApplicationError(ex, heContext, "Extension method execution: Text.StringBuilder_Create");
                throw ex;
            } finally {
                if (errorLogId != string.Empty || (!heContext.AppInfo.SelectiveLoggingEnabled ||
                                                   (heContext.AppInfo.ExtensionProperties.AllowLogging("b69aa077-acf4-4bdc-bcd5-9def81d7ddcd") && heContext.AppInfo.Properties.AllowLogging)))
                {
                    int extLogCount = heContext.ExtensionLogCount;
                    if (extLogCount == _maxExtensionLogsPerRequest)
                    {
                        // issue warning
                        GeneralLog.StaticWrite(
                            DateTime.Now, heContext.Session.SessionID, heContext.AppInfo.eSpaceId, heContext.AppInfo.Tenant.Id,
                            heContext.Session.UserId, "The maximum number (" + _maxExtensionLogsPerRequest + ") of allowed Extension Log entries per request has been exceeded. No more entries will be logged in this request.",
                            "WARNING", "SLOWEXTENSION", "");
                        heContext.ExtensionLogCount = extLogCount + 1;
                    }
                    else if (extLogCount < _maxExtensionLogsPerRequest)
                    {
                        DateTime instant           = DateTime.Now;
                        int      executionDuration = Convert.ToInt32(DateTime.Now.Subtract(startTime).TotalMilliseconds);
                        ExtensionLog.StaticWrite(heContext.AppInfo, heContext.Session,
                                                 instant, executionDuration, "StringBuilder_Create", errorLogId, 20, "Text");
                        heContext.ExtensionLogCount = extLogCount + 1;
                        RequestTracer reqTracer = heContext.RequestTracer;
                        if (reqTracer != null)
                        {
                            reqTracer.RegisterExtensionExecuted("f13768e4-0fbe-4be7-a870-51b5c8362fed", "StringBuilder_Create", "794c445f-f27d-4f61-b47a-0da71440df68", "ContactManager", executionDuration, instant);
                        }
                    }
                }
                RuntimePlatformUtils.LogSlowExtensionCall(startTime, "Text.StringBuilder_Create");
            }
        }
Example #3
0
        public static void MssIsAjaxRequest(HeContext heContext, out bool outParamIsAjaxRequest)
        {
            DateTime startTime  = DateTime.Now;
            String   errorLogId = "";

            try {
                issHTTPRequestHandler.MssIsAjaxRequest(out outParamIsAjaxRequest);
            } catch (Exception ex) {
                errorLogId = ErrorLog.LogApplicationError(ex, heContext, "Extension method execution: HTTPRequestHandler.IsAjaxRequest");
                throw ex;
            } finally {
                if (errorLogId != string.Empty || (!heContext.AppInfo.SelectiveLoggingEnabled ||
                                                   (heContext.AppInfo.ExtensionProperties.AllowLogging("b1ef216b-d67f-454e-9f01-a7f0274608d6") && heContext.AppInfo.Properties.AllowLogging)))
                {
                    int extLogCount = heContext.ExtensionLogCount;
                    if (extLogCount == _maxExtensionLogsPerRequest)
                    {
                        // issue warning
                        GeneralLog.StaticWrite(
                            DateTime.Now, heContext.Session.SessionID, heContext.AppInfo.eSpaceId, heContext.AppInfo.Tenant.Id,
                            heContext.Session.UserId, "The maximum number (" + _maxExtensionLogsPerRequest + ") of allowed Extension Log entries per request has been exceeded. No more entries will be logged in this request.",
                            "WARNING", "SLOWEXTENSION", "");
                        heContext.ExtensionLogCount = extLogCount + 1;
                    }
                    else if (extLogCount < _maxExtensionLogsPerRequest)
                    {
                        DateTime instant           = DateTime.Now;
                        int      executionDuration = Convert.ToInt32(DateTime.Now.Subtract(startTime).TotalMilliseconds);
                        ExtensionLog.StaticWrite(heContext.AppInfo, heContext.Session,
                                                 instant, executionDuration, "IsAjaxRequest", errorLogId, 13, "HTTPRequestHandler");
                        heContext.ExtensionLogCount = extLogCount + 1;
                        RequestTracer reqTracer = heContext.RequestTracer;
                        if (reqTracer != null)
                        {
                            reqTracer.RegisterExtensionExecuted("42593b4a-86fc-4724-8a21-f53e64e0e175", "IsAjaxRequest", "794c445f-f27d-4f61-b47a-0da71440df68", "ContactManager", executionDuration, instant);
                        }
                    }
                }
                RuntimePlatformUtils.LogSlowExtensionCall(startTime, "HTTPRequestHandler.IsAjaxRequest");
            }
        }