コード例 #1
0
ファイル: ShellContext.cs プロジェクト: timothydodd/dbshell
        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);
            }
        }
コード例 #2
0
ファイル: Logs.cs プロジェクト: giladmadmon/image_ex3
        /// <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 { }
        }