Publish() public method

Raises a log message with the provided data.
public Publish ( MessageLevel level, MessageFlags flags, string eventName, string message = null, string details = null, Exception exception = null ) : void
level MessageLevel the level of the message
flags MessageFlags associated flags
eventName string A short name about what this message is detailing. Typically this will be a few words.
message string A longer message than giving more specifics about the actual message. /// Typically, this will be up to 1 line of text.
details string A long text field with the details of the message.
exception System.Exception An exception object if one is provided.
return void
Example #1
0
        static ThreadPoolTrace()
        {
            WorksInThisRuntime = false;

            try
            {
                s_threadPoolType = typeof(ThreadPool);
                s_threadPoolGetQueuedWorkItemsMethod = s_threadPoolType.GetMethod("GetQueuedWorkItems", BindingFlags.Static | BindingFlags.NonPublic);

                s_queueWorkerCallbackType = Type.GetType("System.Threading.QueueUserWorkItemCallback");
                s_callbackField           = s_queueWorkerCallbackType?.GetField("callback", BindingFlags.NonPublic | BindingFlags.Instance);
                s_stateField          = s_queueWorkerCallbackType?.GetField("state", BindingFlags.NonPublic | BindingFlags.Instance);
                s_timerQueueTimerType = Type.GetType("System.Threading.TimerQueueTimer");
                s_timerQueueTimerTimerCallbackField = s_timerQueueTimerType?.GetField("m_timerCallback", BindingFlags.NonPublic | BindingFlags.Instance);
                s_timerQueueType = Type.GetType("System.Threading.TimerQueue");
                s_timerQueueFireQueuedTimerCompletionMethod = s_timerQueueType?.GetMethod("FireQueuedTimerCompletion", BindingFlags.NonPublic | BindingFlags.Static);
                s_timerType = typeof(System.Timers.Timer);
                s_timerOnIntervalElapsedField = s_timerType?.GetField("onIntervalElapsed", BindingFlags.NonPublic | BindingFlags.Instance);
                WorksInThisRuntime            = true;
            }
            catch (Exception ex)
            {
                Log.Publish(MessageLevel.Error, MessageFlags.BugReport, "Error in constructor", null, null, ex);
            }
        }
Example #2
0
        static ThreadPoolMonitor()
        {
            if (OptimizationOptions.EnableThreadPoolMonitoring)
            {
                s_monitors = new List <Monitor>();
                s_monitors.Add(new Monitor(0));
                s_monitors.Add(new Monitor(10));
                s_monitors.Add(new Monitor(100));
                s_monitors.Add(new Monitor(1000));

                s_lastResetTime = ShortTime.Now;

                Log.Publish(MessageLevel.Info, "Starting ThreadPool Monitoring.");

                LoadingAdjustedTimestamp.OnHighLoad += LoadingAdjustedTimestamp_OnHighLoad;
            }
        }
Example #3
0
 private static void Error1(LogPublisher pub2)
 {
     try
     {
         int value = int.Parse("dk20");
     }
     catch (Exception ex)
     {
         pub2.Publish(MessageLevel.Critical, "Failed Cast", null, null, ex);
     }
 }
Example #4
0
        static TimerTrace()
        {
            WorksInThisRuntime = false;

            try
            {
                s_timerQueueType           = Type.GetType("System.Threading.TimerQueue");
                s_timerQueueInstanceMethod = s_timerQueueType?.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static)?.GetMethod;
                s_timerQueueTimersField    = s_timerQueueType?.GetField("m_timers", BindingFlags.NonPublic | BindingFlags.Instance);

                s_timerQueueTimerType = Type.GetType("System.Threading.TimerQueueTimer");
                s_timerQueueTimerTimerCallbackField = s_timerQueueTimerType?.GetField("m_timerCallback", BindingFlags.NonPublic | BindingFlags.Instance);
                s_timerQueueTimerNextField          = s_timerQueueTimerType?.GetField("m_next", BindingFlags.NonPublic | BindingFlags.Instance);

                s_timerType = typeof(System.Timers.Timer);
                s_timerOnIntervalElapsedField = s_timerType?.GetField("onIntervalElapsed", BindingFlags.NonPublic | BindingFlags.Instance);
                WorksInThisRuntime            = true;
            }
            catch (Exception ex)
            {
                Log.Publish(MessageLevel.Error, MessageFlags.BugReport, "Error in constructor", null, null, ex);
            }
        }