Exemplo n.º 1
0
        /// <summary>
        /// Sets up the Logger instance. 
        /// </summary>
        /// <param name="checkPeriod">How often the Logger thread should check the queue.</param>
        /// <param name="sinks">Sinks to install into the logger</param>
        public static void Setup(int checkPeriod, params ILoggerSink[] sinks)
        {
            _sinks = sinks;
            _stopMode = StopMode.CanRun;
            _checkPeriod = checkPeriod;

            Debug = new LoggerWriter ("D", EnqueueMessage);
            Warning = new LoggerWriter ("W", EnqueueMessage);
            Error = new LoggerWriter ("E", EnqueueMessage);

            _waitStopSemaphore = new SemaphoreSlim (0, 1);
            _messageQueue = new ConcurrentQueue<LoggerMessage> ();
            new Thread (new ThreadStart (MessageCatcher)).Start ();
        }
 public ConsoleRedirectorStream(LoggerWriter dest)
 {
     _destLog = dest;
 }