Exemplo n.º 1
0
        public AsyncLog(TimeSource timeSource, IAppender appender, IFormatter formatter)
        {
            _timeSource = timeSource ?? throw new ArgumentNullException(nameof(timeSource));
            _appender   = appender ?? throw new ArgumentNullException(nameof(appender));
            _formatter  = formatter ?? throw new ArgumentNullException(nameof(formatter));

            _lines      = new BlockingCollection <LogLine>();
            _flushEvent = new ManualResetEventSlim();

            _runThread = new Thread(this.MainLoop);
            _runThread.Start();
        }
Exemplo n.º 2
0
 public FileAppenderFactory(TimeSource timeSource)
 {
     TimeSource   = timeSource ?? throw new ArgumentNullException(nameof(timeSource));
     LogDirectory = Directory.GetCurrentDirectory();
 }
Exemplo n.º 3
0
 public AsyncLog(TimeSource timeSource) : this(timeSource, new RollingAppender(timeSource, Settings.CreateFileAppenderFactory(timeSource)), new LogLineFormatter())
 {
 }
Exemplo n.º 4
0
 public RollingAppender(TimeSource timeSource, IAppenderFactory factory)
 {
     _timeSource = timeSource ?? throw new ArgumentNullException(nameof(timeSource));
     _factory    = factory ?? throw new ArgumentNullException(nameof(factory));
 }