コード例 #1
0
    protected void ReloadData()
    {
        if (!RequestDebug.Settings.Enabled)
        {
            ShowWarning(GetString("DebugRequests.NotConfigured"));
        }
        else
        {
            plcLogs.Controls.Clear();

            var requestLogs = RequestDebug.Settings.LastLogs;

            RequestLog lastLog = null;

            for (int i = requestLogs.Count - 1; i >= 0; i--)
            {
                try
                {
                    // Get the request log
                    var log = requestLogs[i];
                    if (log != null)
                    {
                        // Load the control only if there is more than only request log
                        var logs = log.ParentLogs;
                        if (logs != null)
                        {
                            AllLog logCtrl = (AllLog)LoadLogControl(log, "~/CMSAdminControls/Debug/AllLog.ascx", i);

                            logCtrl.PreviousLog         = lastLog;
                            logCtrl.Logs                = logs;
                            logCtrl.ShowCompleteContext = chkCompleteContext.Checked;

                            // Add to the output
                            plcLogs.Append(logCtrl);

                            lastLog = log;
                        }
                    }
                }
                catch
                {
                }
            }
        }
    }
コード例 #2
0
    protected void ReloadData()
    {
        if (!RequestHelper.DebugRequests)
        {
            ShowWarning(GetString("DebugRequests.NotConfigured"), null, null);
        }
        else
        {
            plcLogs.Controls.Clear();

            for (int i = RequestHelper.LastLogs.Count - 1; i >= 0; i--)
            {
                try
                {
                    // Get the request log
                    RequestLog log = (RequestLog)RequestHelper.LastLogs[i];
                    if (log != null)
                    {
                        List <DataTable> logs = AllLog.GetLogs(log);

                        // Load the control only if there is more than only request log
                        if (logs.Count > 1)
                        {
                            AllLog logCtrl = (AllLog)LoadUserControl("~/CMSAdminControls/Debug/AllLog.ascx");
                            logCtrl.ID = "allLog_" + i;
                            logCtrl.EnableViewState     = false;
                            logCtrl.Logs                = logs;
                            logCtrl.DisplayHeader       = false;
                            logCtrl.ShowCompleteContext = chkCompleteContext.Checked;

                            // Add to the output
                            plcLogs.Controls.Add(new LiteralControl("<div>&lrm;<strong>&nbsp;" + GetRequestLink(log.RequestURL, log.RequestGUID) + "</strong> (" + log.RequestTime.ToString("hh:mm:ss") + ")&lrm;<br /><br />"));
                            plcLogs.Controls.Add(logCtrl);
                            plcLogs.Controls.Add(new LiteralControl("</div><br /><br />"));
                        }
                    }
                }
                catch
                {
                }
            }
        }
    }
コード例 #3
0
    /// <summary>
    /// Returns system information (renderes control on Site Manager / System / General tab).
    /// </summary>
    private string GetDebug()
    {
        StringBuilder sb = new StringBuilder();

        int id = 0;

        for (int i = RequestHelper.LastLogs.Count - 1; i >= 0; i--)
        {
            // Get the request log
            RequestLog log = (RequestLog)RequestHelper.LastLogs[i];
            if (log != null)
            {
                List <DataTable> logs = AllLog.GetLogs(log);
                if (logs.Count > 1)
                {
                    DataTable table = AllLog.MergeTables(logs, this.Page, false);

                    string tdStyle     = "style=\"border: 1px solid rgb(204, 204, 204);\"";
                    string evenStyle   = "style=\"background-color: rgb(244, 244, 244);\"";
                    string headerStyle = "style=\"border: 1px solid rgb(204, 204, 204); white-space: nowrap;\" scope=\"col\"";
                    string tableStyle  = "style=\"background-color: White; border-color: rgb(204, 204, 204); border-style: solid; width: 100%; border-collapse: collapse;\"";

                    sb.Append("<div style=\"margin-top: 15px;\"><strong>" + log.RequestURL + "</strong>" + "&nbsp;(" + log.RequestTime + ")<br/>");

                    sb.Append(
                        "<table " + tableStyle + "><tbody><tr " + evenStyle + " align=\"left\"><th " + headerStyle + ">&nbsp;</th>",
                        "<th " + headerStyle + ">",
                        GetString("AllLog.DebugType"),
                        "</th><th " + headerStyle + ">",
                        GetString("AllLog.Information"),
                        "</th><th " + headerStyle + ">",
                        GetString("AllLog.Result"),
                        "</th><th " + headerStyle + ">",
                        GetString("AllLog.Context"),
                        "</th><th " + headerStyle + ">",
                        GetString("AllLog.TotalDuration"),
                        "</th><th " + headerStyle + ">",
                        GetString("AllLog.Duration"),
                        "</th></tr>");

                    bool even = false;
                    foreach (DataRow dr in table.Rows)
                    {
                        sb.Append(
                            "<tr" + (even ? " " + evenStyle : "") + "><td " + tdStyle + "><strong>",
                            dr["Index"],
                            "</strong></td><td " + tdStyle + ">",
                            dr["DebugType"],
                            "</td><td " + tdStyle + ">",
                            dr["Information"],
                            "</td><td " + tdStyle + ">",
                            dr["Result"],
                            "</td><td " + tdStyle + " align=\"right\">",
                            GetContext(dr["Context"].ToString(), id++),
                            "</td><td " + tdStyle + " width=\"70px\" align=\"right\">",
                            dr["TotalDuration"],
                            "</td><td " + tdStyle + " width=\"70px\" align=\"right\">",
                            dr["Duration"],
                            "</td></tr>");
                        even = !even;
                    }

                    sb.Append("</tbody></table></div>");
                }
            }
        }

        return(sb.ToString());
    }