Пример #1
0
        public bool GetOnOff(LogLevel level)
        {
            if (!LoggingEnabled)
            {
                return(false);
            }

            LogOnOff onOff = LogOnOffManager.GetLogOnOff();

            if (level == LogLevel.Debug && onOff.Debug != 1)
            {
                return(false);
            }
            if (level == LogLevel.Info && onOff.Info != 1)
            {
                return(false);
            }
            if (level == LogLevel.Warn && onOff.Warn != 1)
            {
                return(false);
            }
            if (level == LogLevel.Error && onOff.Error != 1)
            {
                return(false);
            }
            return(true);
        }
Пример #2
0
        private static void Send(IList <ILogEntity> buffer)
        {
            long size = sender.Send(buffer);

            LogOnOffManager.RefreshLogOnOff();
            PrivateMetric("logging_client_send_data_size", size);
        }
Пример #3
0
        protected virtual void Log(string title, string message, Dictionary <string, string> tags, LogLevel level)
        {
            Console.WriteLine(LoggingEnabled);

            Console.WriteLine(Settings.LoggingEnabled);

            if (!LoggingEnabled)
            {
                return;
            }

            LogOnOff onOff = LogOnOffManager.GetLogOnOff();

            if (level == LogLevel.Debug && onOff.Debug != 1)
            {
                return;
            }
            if (level == LogLevel.Info && onOff.Info != 1)
            {
                return;
            }
            if (level == LogLevel.Warn && onOff.Warn != 1)
            {
                return;
            }
            if (level == LogLevel.Error && onOff.Error != 1)
            {
                return;
            }

            LogEntity log = this.CreateLog(Source, title, message, tags, level);

            block.Enqueue(log);
        }