Subscribes to log events.
Inheritance: IDisposable
Ejemplo n.º 1
0
 /// <summary>
 /// Creates a LogFileWriter that initially queues message
 /// </summary>
 public LogSubscriptionConsole()
 {
     m_verbose    = VerboseLevel.None;
     m_subscriber = Logger.CreateSubscriber(m_verbose);
     m_subscriber.SubscribeToAll(m_verbose);
     m_subscriber.NewLogMessage += SubscriberNewLogMessage;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a <see cref="LogSubscriber"/>
        /// </summary>
        /// <returns></returns>
        public static LogSubscriber CreateSubscriber(VerboseLevel level = VerboseLevel.None)
        {
            var subscriber = new LogSubscriber(s_logger.CreateSubscriber());

            subscriber.SubscribeToAll(level);
            return(subscriber);
        }
 /// <summary>
 /// Creates a LogFileWriter that initially queues message
 /// </summary>
 public LogSubscriptionConsole()
 {
     m_verbose = VerboseLevel.None;
     m_subscriber = Logger.CreateSubscriber(m_verbose);
     m_subscriber.SubscribeToAll(m_verbose);
     m_subscriber.NewLogMessage += SubscriberNewLogMessage;
 }
        /// <summary>
        /// Creates a new <see cref="ServiceHost"/> instance.
        /// </summary>
        public ServiceHost()
        {
            ServiceName = "openHistorian";

            m_logSubscriber = Logger.CreateSubscriber();
            m_logSubscriber.SubscribeToAssembly(typeof(Number).Assembly, VerboseLevel.High);
            m_logSubscriber.SubscribeToAssembly(typeof(HistorianKey).Assembly, VerboseLevel.High);
            m_logSubscriber.NewLogMessage += m_logSubscriber_Log;
        }
        /// <summary>
        /// Creates a LogFileWriter that initially queues message
        /// </summary>
        /// <param name="messageLimit">the number of messages to maintain</param>
        public LogSubscriptionFileWriter(int messageLimit)
        {
            m_processName = Process.GetCurrentProcess().ProcessName;
            m_fileSequenceNumber = 1;
            m_syncRoot = new object();
            m_maxQueue = messageLimit;
            m_messageQueue = new ConcurrentQueue<LogMessage>();

            m_flushTask = new ScheduledTask();
            m_flushTask.Running += m_flushTask_Running;

            m_verbose = VerboseLevel.High;
            m_subscriber = Logger.CreateSubscriber(m_verbose);
            m_subscriber.SubscribeToAll(m_verbose);
            m_subscriber.NewLogMessage += SubscriberNewLogMessage;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates a LogFileWriter that initially queues message
        /// </summary>
        /// <param name="messageLimit">the number of messages to maintain</param>
        public LogSubscriptionFileWriter(int messageLimit)
        {
            m_processName        = Process.GetCurrentProcess().ProcessName;
            m_fileSequenceNumber = 1;
            m_syncRoot           = new object();
            m_maxQueue           = messageLimit;
            m_messageQueue       = new ConcurrentQueue <LogMessage>();

            m_flushTask          = new ScheduledTask();
            m_flushTask.Running += m_flushTask_Running;

            m_verbose    = VerboseLevel.High;
            m_subscriber = Logger.CreateSubscriber(m_verbose);
            m_subscriber.SubscribeToAll(m_verbose);
            m_subscriber.NewLogMessage += SubscriberNewLogMessage;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates a <see cref="LogSubscriber"/>
 /// </summary>
 /// <returns></returns>
 public static LogSubscriber CreateSubscriber(VerboseLevel level = VerboseLevel.None)
 {
     var subscriber = new LogSubscriber(s_logger.CreateSubscriber());
     subscriber.SubscribeToAll(level);
     return subscriber;
 }