Exemplo n.º 1
0
        public async Task SetSearchDirectorAsync(SearchDirector searchDirector)
        {
            BufferEntry[] records;

            lock (this._lockObj)
            {
                this._searchDirector = searchDirector;
                records = this._buffer.ToArray();
                this._buffer.Clear();
            }

            if (records.Length == 0)
            {
                return;
            }

            try
            {
                foreach (var record in records)
                {
                    await searchDirector.LogAsync(record.Message, record.IsError, record.Timestamp).ConfigureAwait(false);
                }
            }
            catch (Exception ex)
            {
                try
                {
                    Console.Error.WriteLine("[{0}] Log Error: {1}", DateTime.Now, ex);
                }
                catch { }
            }
        }
Exemplo n.º 2
0
 public SearchAgent(Logger logger, WagahighOperator wagahighOperator, SearchDirector searchDirector, CancellationToken cancellationToken)
 {
     this._logger            = logger;
     this._wagahighOperator  = wagahighOperator;
     this._searchDirector    = searchDirector;
     this._cancellationToken = cancellationToken;
 }