/// <summary> /// Monitor the chat client on the background thread /// </summary> public override void Monitor() { string message; if (TryGet(out message)) { if (!ConsumeMessage(message)) { if (LogMonitor != null) { LogMonitor.Invoke(message); } m_Message = message; } } }
public void Write(EventType eventType, Func <string> logMessage) { string message = null; if (eventType >= MinLevel) { try { message = logMessage(); Write(eventType, Name, message.Limit(10000, true)); } catch (Exception ex) { Write(EventType.Error, GetType().Name, string.Format( "Error while getting the log message ({0}: {1}). {2}", eventType, Name, ex.ToString())); } } _logMonitor?.Invoke(eventType, Name, message != null ? () => message : logMessage); // Ensures only one evaluation of the logMessage function. }