Beispiel #1
0
        public void TestMethod1()
        {
            ShutdownHandler.Initialize();

            Logger.Console.Verbose = VerboseLevel.Ultra;
            LogPublisher pub2;

            var pub1 = Logger.CreatePublisher(typeof(LoggerTest), MessageClass.Application);

            using (Logger.AppendStackMessages("Test2", "Adapter2"))
                pub2 = Logger.CreatePublisher(typeof(int), MessageClass.Application);

            Error1(pub2);
            using (Logger.SuppressFirstChanceExceptionLogMessages())
            {
                Error1(pub2);
            }
            using (Logger.SuppressLogMessages())
            {
                Error1(pub1);
            }

            using (Logger.SuppressLogMessages())
                using (Logger.AppendStackMessages("Test1", "Adapter1"))
                    using (Logger.OverrideSuppressLogMessages())
                    {
                        Error1(pub2);
                    }

            ShutdownHandler.InitiateSafeShutdown();
        }
        private void ServiceHelper_ServiceStopping(object sender, EventArgs eventArgs)
        {
            // Shutdown algorithm processing framework
            StopAlgorithmProcessing();

            // Dispose of run-time log
            if ((object)m_runTimeLog != null)
            {
                m_serviceHelper.ServiceComponents.Remove(m_runTimeLog);
                m_runTimeLog.ProcessException -= ProcessExceptionHandler;
                m_runTimeLog.Dispose();
                m_runTimeLog = null;
            }

            if (m_allowServiceMonitors && (object)m_serviceMonitors != null)
            {
                m_serviceMonitors.AdapterLoaded   -= ServiceMonitors_AdapterLoaded;
                m_serviceMonitors.AdapterUnloaded -= ServiceMonitors_AdapterUnloaded;
                m_serviceMonitors.Dispose();
            }

            // Deregister event handlers
            m_serviceHelper.ServiceStarting -= ServiceHelper_ServiceStarting;
            m_serviceHelper.ServiceStarted  -= ServiceHelper_ServiceStarted;
            m_serviceHelper.ServiceStopping -= ServiceHelper_ServiceStopping;

            // Detach from handler for unobserved task exceptions
            TaskScheduler.UnobservedTaskException -= TaskScheduler_UnobservedTaskException;

            ShutdownHandler.InitiateSafeShutdown();
        }
Beispiel #3
0
        public void TestMethod1()
        {
            ShutdownHandler.Initialize();

            Logger.Console.Verbose = VerboseLevel.Ultra;
            System.Console.WriteLine(LoadingAdjustedTimestamp.CurrentTime);
            Thread.Sleep(1000);
            System.Console.WriteLine(LoadingAdjustedTimestamp.CurrentTime);
            ShutdownHandler.InitiateSafeShutdown();
            Thread.Sleep(1000);
        }
Beispiel #4
0
 static void Main()
 {
     ShutdownHandler.Initialize();
     try
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new LogFileViewer());
     }
     finally
     {
         ShutdownHandler.InitiateSafeShutdown();
     }
 }