public void LogMessage(LogMessageRecord message) { if (_parent != null) { _parent.LogMessage(message); } else { if (message.Number == null) { message.Number = ++_loggedMessageCount; } message.SendToSystemLogger(_logger); } foreach (var logger in _additionalLoggers) { logger.LogMessage(message); } }
/// <summary> /// Adds the logs to the logs list. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Communication.Model.Event.DataReceivedEventArgs" /> instance containing the event data.</param> private void AddLogs(object sender, Communication.Model.Event.DataReceivedEventArgs e) { try { CommandMessage cmdMsg = CommandMessage.FromJSON(e.Data); if (cmdMsg.CmdId == CommandEnum.LogCommand) { foreach (string logMsg in cmdMsg.Args) { LogMessageRecord msgRcrd = LogMessageRecord.FromJSON(logMsg); if (m_typeFilter == null || msgRcrd.Type.ToString().Equals(m_typeFilter)) { this.LogMessages.Add(new LogMessageRecord(msgRcrd.Message, msgRcrd.Type)); } } ClientCommunication.Instance.OnDataRecieved -= AddLogs; finishedGettingLogs = true; } } catch { } }