Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            var on_offs = LogOnOffManager.GetALLLogOnOff();

            context.Response.ContentType = "text/plain";
            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(on_offs));
        }
Example #2
0
        public dynamic SetLogOnOff(int appId, string appName, int debug = 1, int info = 1, int warn = 1, int error = 1)
        {
            LogOnOff on_off = new LogOnOff();

            on_off.AppId   = appId;
            on_off.Debug   = (byte)debug;
            on_off.Info    = (byte)info;
            on_off.Warn    = (byte)warn;
            on_off.Error   = (byte)error;
            on_off.AppName = appName;

            LogOnOffManager.SetLogOnOff(on_off);

            return(0);
        }
Example #3
0
        public void ProcessRequest(HttpContext context)
        {
            int    appId   = Convert.ToInt32(context.Request["appId"]);
            string appName = context.Request["appName"];
            int    debug   = Convert.ToInt32(context.Request["debug"]);
            int    info    = Convert.ToInt32(context.Request["info"]);
            int    warn    = Convert.ToInt32(context.Request["warn"]);
            int    error   = Convert.ToInt32(context.Request["error"]);

            LogOnOff on_off = new LogOnOff();

            on_off.AppId   = appId;
            on_off.Debug   = (byte)debug;
            on_off.Info    = (byte)info;
            on_off.Warn    = (byte)warn;
            on_off.Error   = (byte)error;
            on_off.AppName = appName;

            LogOnOffManager.SetLogOnOff(on_off);


            context.Response.ContentType = "text/plain";
            context.Response.Write("Hello World");
        }
Example #4
0
        private static void ProcessLog(TLogPackage logPackage)
        {
            if (logPackage.LogItems == null || logPackage.LogItems.Count == 0)
            {
                return;
            }

            List <TLogEntity> logEntities = logPackage.LogItems;
            var _logEntities = new List <LogEntity>();

            var log_on_off = LogOnOffManager.GetLogOnOff(logPackage.AppId);

            foreach (var item in logEntities)
            {
                if (item.Level == (int)LogLevel.Debug && log_on_off.Debug == 0)
                {
                    continue;
                }
                if (item.Level == (int)LogLevel.Info && log_on_off.Info == 0)
                {
                    continue;
                }
                if (item.Level == (int)LogLevel.Warm && log_on_off.Warm == 0)
                {
                    continue;
                }
                if (item.Level == (int)LogLevel.Error && log_on_off.Error == 0)
                {
                    continue;
                }

                List <string> tags = new List <string>();

                if (item.Tags != null && item.Tags.Count > 0)
                {
                    foreach (var tag in item.Tags)
                    {
                        tags.Add(tag.Key.Replace("=", string.Empty) + "=" + tag.Value);
                    }
                }

                LogEntity _log = new LogEntity();
                _log.IP      = logPackage.IP;
                _log.Level   = (LogLevel)item.Level;
                _log.Message = item.Message;
                _log.Tags    = tags;
                _log.Title   = item.Title;
                _log.Source  = item.Source;
                _log.Thread  = item.Thread;
                _log.Time    = item.Time;
                _log.AppId   = logPackage.AppId;
                _logEntities.Add(_log);
            }

            if (_logEntities.Count == 0)
            {
                return;
            }

            var processor = LogProcessorManager.GetLogProcessor();

            processor.Process(_logEntities);
        }
Example #5
0
        public dynamic GetLogOnOffs()
        {
            var on_offs = LogOnOffManager.GetALLLogOnOff();

            return(Newtonsoft.Json.JsonConvert.SerializeObject(on_offs));
        }