Esempio n. 1
0
        /// <summary>
        /// Creates a <see cref="LoggerInternal"/>.
        /// </summary>
        public LoggerInternal(out LoggerInternal loggerClass)
        {
            //Needed to set the member variable of Logger.
            //This is because ScheduleTask will call Logger before Logger's static constructor is completed.
            loggerClass = this;

            m_syncRoot       = new object();
            m_typeIndexCache = new Dictionary <Type, LogPublisherInternal>();
            m_allPublishers  = new List <LogPublisherInternal>();
            m_subscribers    = new List <NullableWeakReference>();
            m_messages       = new ConcurrentQueue <Tuple <LogMessage, LogPublisherInternal> >();

            // Since ScheduledTask calls ShutdownHandler, which calls Logger. This initialization method cannot occur
            // until after the Logger static class has finished initializing.
            m_calculateRoutingTable          = new ScheduledTask();
            m_calculateRoutingTable.Running += CalculateRoutingTable;
            m_calculateRoutingTable.IgnoreShutdownEvent();
            m_routingTask          = new ScheduledTask(ThreadingMode.DedicatedForeground);
            m_routingTask.Running += RoutingTask;
            m_routingTask.IgnoreShutdownEvent();
        }