Can be used to publish event messages.
        static LoadingAdjustedTimestamp()
        {
            Reset();

            Log = Logger.CreatePublisher(typeof(LoadingAdjustedTimestamp), MessageClass.Component);
            LogLoadingClock = Log.RegisterEvent(MessageLevel.Info, MessageFlags.SystemHealth, $"Loading Clock is behind", 0, MessageRate.EveryFewSeconds(1), 1);
            LogSmall = Log.RegisterEvent(MessageLevel.Info, MessageFlags.SystemHealth, $"Short High Load Condition Detected", 0, MessageRate.EveryFewSeconds(10), 5);
            LogMedium = Log.RegisterEvent(MessageLevel.Warning, MessageFlags.SystemHealth, $"Medium High Load Condition Detected", 0, MessageRate.EveryFewSeconds(10), 5);
            LogLarge = Log.RegisterEvent(MessageLevel.Error, MessageFlags.SystemHealth, $"Long High Load Condition Detected", 0, MessageRate.EveryFewSeconds(10), 5);

            LogLoadingClock.ShouldRaiseMessageSupressionNotifications = false;
            LogSmall.ShouldRaiseMessageSupressionNotifications = false;
            LogMedium.ShouldRaiseMessageSupressionNotifications = false;
            LogLarge.ShouldRaiseMessageSupressionNotifications = false;

            MonitorHighThread = new Thread(MonitorHighPriority, short.MaxValue);
            MonitorHighThread.Priority = ThreadPriority.Highest;
            MonitorHighThread.IsBackground = true;
            MonitorHighThread.Start();

            MonitorNormalThread = new Thread(MonitorNormalPriority, short.MaxValue);
            MonitorNormalThread.Priority = ThreadPriority.Normal;
            MonitorNormalThread.IsBackground = true;
            MonitorNormalThread.Start();

            MonitorLowThread = new Thread(MonitorLowPriority, short.MaxValue);
            MonitorLowThread.Priority = ThreadPriority.Lowest;
            MonitorLowThread.IsBackground = true;
            MonitorLowThread.Start();
        }
示例#2
0
 public Monitor(int delay)
 {
     m_logSmall  = Log.RegisterEvent(MessageLevel.Info, MessageFlags.SystemHealth, $"ThreadPool Small Delay Variance ({delay} ms)", 0, MessageRate.EveryFewSeconds(10), 5);
     m_logMedium = Log.RegisterEvent(MessageLevel.Warning, MessageFlags.SystemHealth, $"ThreadPool Medium Delay Variance ({delay} ms)", 0, MessageRate.EveryFewSeconds(10), 5);
     m_logLarge  = Log.RegisterEvent(MessageLevel.Error, MessageFlags.SystemHealth, $"ThreadPool Large Delay Variance ({delay} ms)", 0, MessageRate.EveryFewSeconds(10), 5);
     m_logSmall.ShouldRaiseMessageSupressionNotifications  = false;
     m_logMedium.ShouldRaiseMessageSupressionNotifications = false;
     m_logLarge.ShouldRaiseMessageSupressionNotifications  = false;
     m_delay         = delay;
     m_time          = null;
     m_task          = new ScheduledTask();
     m_task.Running += task_Running;
 }
 public Monitor(int delay)
 {
     m_logSmall = Log.RegisterEvent(MessageLevel.Info, MessageFlags.SystemHealth, $"ThreadPool Small Delay Variance ({delay} ms)", 0, MessageRate.EveryFewSeconds(10), 5);
     m_logMedium = Log.RegisterEvent(MessageLevel.Warning, MessageFlags.SystemHealth, $"ThreadPool Medium Delay Variance ({delay} ms)", 0, MessageRate.EveryFewSeconds(10), 5);
     m_logLarge = Log.RegisterEvent(MessageLevel.Error, MessageFlags.SystemHealth, $"ThreadPool Large Delay Variance ({delay} ms)", 0, MessageRate.EveryFewSeconds(10), 5);
     m_logSmall.ShouldRaiseMessageSupressionNotifications = false;
     m_logMedium.ShouldRaiseMessageSupressionNotifications = false;
     m_logLarge.ShouldRaiseMessageSupressionNotifications = false;
     m_delay = delay;
     m_time = null;
     m_task = new ScheduledTask();
     m_task.Running += task_Running;
 }
示例#4
0
文件: Logger.cs 项目: sotaria/gsf
        static Logger()
        {
            //Initializes the empty object of StackTraceDetails
            LogStackTrace.Initialize();
            LogStackMessages.Initialize();
            GrowStackDisposal(1);

            s_logger   = new LoggerInternal(out s_logger);
            Console    = new LogSubscriptionConsole();
            FileWriter = new LogSubscriptionFileWriter(1000);

            AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
            AppDomain.CurrentDomain.UnhandledException   += CurrentDomain_UnhandledException;

            Log = CreatePublisher(typeof(Logger), MessageClass.Component);
            Log.InitialStackTrace     = LogStackTrace.Empty;
            EventFirstChanceException = Log.RegisterEvent(MessageLevel.NA, MessageFlags.SystemHealth, "First Chance App Domain Exception", 30, MessageRate.PerSecond(30), 1000);
            EventAppDomainException   = Log.RegisterEvent(MessageLevel.Critical, MessageFlags.SystemHealth, "Unhandled App Domain Exception");
            EventSwallowedException   = Log.RegisterEvent(MessageLevel.Debug, MessageFlags.None, "Exception was Swallowed", 30, MessageRate.PerSecond(30), 1000);

            ShutdownHandler.Initialize();
        }
        // Static Constructor
        static ServiceHelper()
        {
            s_log = Logger.CreatePublisher(typeof(ServiceHelper), MessageClass.Framework);

            s_logError = s_log.RegisterEvent(MessageLevel.Error, MessageFlags.None, "Error Message", 0, MessageRate.PerSecond(30), 1000);
            s_logStatusInfo = s_log.RegisterEvent(MessageLevel.Info, MessageFlags.None, "Status Message Info", 0, MessageRate.PerSecond(30), 1000);
            s_logStatusWarning = s_log.RegisterEvent(MessageLevel.Warning, MessageFlags.None, "Status Message Warning", 0, MessageRate.PerSecond(30), 1000);
            s_logStatusAlarm = s_log.RegisterEvent(MessageLevel.Error, MessageFlags.None, "Status Message Alarm", 0, MessageRate.PerSecond(30), 1000);

            Logger.FileWriter.Verbose = VerboseLevel.Ultra;
            s_log.InitialStackTrace = LogStackTrace.Empty;
        }
示例#6
0
        static Logger()
        {
            //Initializes the empty object of StackTraceDetails
            LogStackTrace.Initialize();
            LogStackMessages.Initialize();
            GrowStackDisposal(1);

            s_logger = new LoggerInternal(out s_logger);
            Console = new LogSubscriptionConsole();
            FileWriter = new LogSubscriptionFileWriter(1000);

            AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            Log = CreatePublisher(typeof(Logger), MessageClass.Component);
            Log.InitialStackTrace = LogStackTrace.Empty;
            EventFirstChanceException = Log.RegisterEvent(MessageLevel.NA, MessageFlags.SystemHealth, "First Chance App Domain Exception", 30, MessageRate.PerSecond(30), 1000);
            EventAppDomainException = Log.RegisterEvent(MessageLevel.Critical, MessageFlags.SystemHealth, "Unhandled App Domain Exception");
            EventSwallowedException = Log.RegisterEvent(MessageLevel.Debug, MessageFlags.None, "Exception was Swallowed", 30, MessageRate.PerSecond(30), 1000);

            ShutdownHandler.Initialize();
        }