Пример #1
0
 protected virtual void OnNotifyErrorMessage(LogMessage message)
 {
     NotifyErrorMessageHandle handler = NotifyErrorMessage;
     if (handler != null) handler(message);
 }
Пример #2
0
 /// <summary>
 /// Write log file message
 /// </summary>
 /// <param name="msg"></param>
 private void SaveMessage(LogMessage msg)
 {
     try
     {
         InitDataSource();
         msg.Id = Guid.NewGuid();
         _dataSource.LogMessages.AddOrUpdate(msg);
         _dataSource.SaveChanges();
     }
     catch (Exception ex)
     {
         Trace.Write(ex.Message + ex.StackTrace);
         Console.Out.Write(ex);
     }
 }
Пример #3
0
 /// <summary>
 /// Enqueue a new log message and release a semaphore
 /// </summary>
 /// <param name="msg">Log message</param>
 public void Write(LogMessage msg)
 {
     if (msg != null)
     {
         lock (_lockObject)
         {
             _logMessages.Enqueue(msg);
             _semaphore.Release();
         }
     }
 }