Example #1
0
 protected void AddEntry(LogEntry e)
 {
     while (_tail.Count >= TailSize) {
         LogEntry old;
         _tail.TryDequeue(out old);
     }
     _tail.Enqueue(e);
     if (e.Kind == EntryKind.SetStatus) {
         SetStatus(e.Guid, e.Message);
     }
 }
Example #2
0
 public virtual void Log(LogEntry e)
 {
     try {
         if (_logfile != null) {
             _logfile.WriteLine("{0} {1}=\"{2}\" #{3} {4} \"{5}\"", e.When.ToString("u"), e.Guid, e.Name, e.SessionId, e.Kind, e.Message);
             _logfile.Flush();
             _logfile.BaseStream?.Flush();
         }
     } catch (IOException ex) {
         _logfile = null;
         AddEntry(new LogEntry() {
             When = DateTime.Now,
             Kind = EntryKind.SetStatus,
             Message = ex.Message
         });
     }
     if (e.Kind == EntryKind.WsRecvDat || e.Kind == EntryKind.WsSendDat) {
         return;
     }
     AddEntry(e);
 }