Example #1
0
        public dynamic GetLogOnOff(int appId = 0)
        {
            string resp = string.Empty;

            var on_off = LogViewerManager.GetLogViewer().GetLogOnOff(appId);

            if (on_off != null)
            {
                resp += on_off.Debug + "," + on_off.Info + "," + on_off.Warn + "," + on_off.Error;
            }

            #region 计数

            TMetricEntity metric = new TMetricEntity();
            metric.Name  = "logging_client_getLogOnOff_count";
            metric.Time  = Utils.GetTimeStamp(DateTime.Now) / 10000000;
            metric.Value = 1;
            metric.Tags  = new Dictionary <string, string>();
            metric.Tags.Add("AppId", appId.ToString());
            List <TMetricEntity> metrics = new List <TMetricEntity>();
            metrics.Add(metric);

            TLogPackage logPackage = new TLogPackage();
            logPackage.AppId       = appId;
            logPackage.IP          = 0;
            logPackage.MetricItems = metrics;

            LogReciverBase LogReciver = new LogReciverBase();

            LogReciver.Log(logPackage);

            #endregion 计数

            return(resp);
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            int appId = Convert.ToInt32(context.Request["appId"]);

            string resp = string.Empty;


            var on_off = LogViewerManager.GetLogViewer().GetLogOnOff(appId);

            if (on_off != null)
            {
                resp += on_off.Debug + "," + on_off.Info + "," + on_off.Warn + "," + on_off.Error;
            }

            #region 计数
            TMetricEntity metric = new TMetricEntity();
            metric.Name  = "logging_client_getLogOnOff_count";
            metric.Time  = Utils.GetTimeStamp(DateTime.Now) / 10000000;
            metric.Value = 1;
            metric.Tags  = new Dictionary <string, string>();
            metric.Tags.Add("AppId", appId.ToString());
            List <TMetricEntity> metrics = new List <TMetricEntity>();
            metrics.Add(metric);


            TLogPackage logPackage = new TLogPackage();
            logPackage.AppId       = appId;
            logPackage.IP          = 0;
            logPackage.MetricItems = metrics;

            LogReciverBase LogReciver = new LogReciverBase();

            LogReciver.Log(logPackage);


            #endregion

            context.Response.Write(resp);
        }