コード例 #1
0
        public void LogMessage(Guid uniqueClientId, DiagnosticMessageType messageType, string message)
        {
            if (uniqueClientId == Guid.Empty)
            {
                throw new ArgumentException("Argument can't be Guid.Empty.", "uniqueClientId");
            }

            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentException("Argument can't be null nor empty.", "message");
            }

            lock (_mutex)
            {
                List <DiagnosticMessage> diagnosticMessages;

                if (!_diagnosticMessagesByClientId.TryGetValue(uniqueClientId, out diagnosticMessages))
                {
                    diagnosticMessages = new List <DiagnosticMessage>();
                    _diagnosticMessagesByClientId.Add(uniqueClientId, diagnosticMessages);
                }

                long messageId = ++_prevMessageId;

                diagnosticMessages.Add(
                    new DiagnosticMessage(
                        messageId,
                        DateTime.UtcNow,
                        messageType,
                        message));
            }
        }
コード例 #2
0
        private void PostDiagnosticMessage(string message, DiagnosticMessageType diagnosticMessageType)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentException("Argument can't be null nor empty.", "message");
            }

            OnDiagnosticMessagePosted(this, new DiagnosticMessageEventArgs(diagnosticMessageType, message));
        }
コード例 #3
0
        protected void PostDiagnosticMessage(string message, DiagnosticMessageType diagnosticMessageType)
        {
            if (string.IsNullOrEmpty(message))
              {
            throw new ArgumentException("Argument can't be null nor empty.", "message");
              }

              OnDiagnosticMessagePosted(this, new DiagnosticMessageEventArgs(diagnosticMessageType, message));
        }
コード例 #4
0
        public DiagnosticMessageEventArgs(DiagnosticMessageType messageType, string message)
        {
            if (string.IsNullOrEmpty(message))
              {
            throw new ArgumentException("Argument can't be null nor empty.", "message");
              }

              MessageType = messageType;
              Message = message;
        }
コード例 #5
0
        public DiagnosticMessageEventArgs(DiagnosticMessageType messageType, string message)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentException("Argument can't be null nor empty.", "message");
            }

            MessageType = messageType;
            Message     = message;
        }
コード例 #6
0
        public DiagnosticMessage(long messageId, DateTime dateUtf, DiagnosticMessageType type, string message)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentException("Argument can't be null nor empty.", "message");
            }

            if (dateUtf.Kind != DateTimeKind.Utc)
            {
                throw new ArgumentException("Argument must be a UTC date.", "dateUtf");
            }

            MessageId = messageId;
            DateUtf   = dateUtf;
            Type      = type;
            Message   = message;
        }
コード例 #7
0
        public DiagnosticMessage(long messageId, DateTime dateUtf, DiagnosticMessageType type, string message)
        {
            if (string.IsNullOrEmpty(message))
              {
            throw new ArgumentException("Argument can't be null nor empty.", "message");
              }

              if (dateUtf.Kind != DateTimeKind.Utc)
              {
            throw new ArgumentException("Argument must be a UTC date.", "dateUtf");
              }

              MessageId = messageId;
              DateUtf = dateUtf;
              Type = type;
              Message = message;
        }
コード例 #8
0
        private void LogMessage(string message, DiagnosticMessageType messageType = DiagnosticMessageType.Info)
        {
            GuiUtils.BeginInvoke(
                this,
                () =>
            {
                if (messageType < MessageTypeThreshold)
                {
                    return;
                }

                txt_log.SelectionStart  = txt_log.Text.Length;
                txt_log.SelectionLength = 0;

                switch (messageType)
                {
                case DiagnosticMessageType.Trace:
                    txt_log.SelectionColor = Color.DimGray;
                    break;

                case DiagnosticMessageType.Info:
                    txt_log.SelectionColor = Color.Blue;
                    break;

                case DiagnosticMessageType.Warn:
                    txt_log.SelectionColor = Color.FromArgb(191, 79, 0);
                    break;

                case DiagnosticMessageType.Error:
                    txt_log.SelectionColor = Color.DarkRed;
                    break;
                }

                txt_log.AppendText(message);
                txt_log.AppendText(Environment.NewLine);

                txt_log.ScrollToCaret();
            });
        }
コード例 #9
0
 public DiagnosticMessage(string text, DiagnosticMessageType type)
 {
     Text = text;
     Type = type;
 }
コード例 #10
0
 public List <DiagnosticMessage> GetDiagnosticMessages(Guid uniqueClientId, long lastSeenMaxMessageId, DiagnosticMessageType minMessageType)
 {
     return(Exec(@as => @as.GetDiagnosticMessages(uniqueClientId, lastSeenMaxMessageId, minMessageType)));
 }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: szkra/UberDeployer
        private void LogMessage(string message, DiagnosticMessageType messageType = DiagnosticMessageType.Info)
        {
            GuiUtils.BeginInvoke(
            this,
            () =>
              {
            if (messageType < MessageTypeThreshold)
            {
              return;
            }

            txt_log.SelectionStart = txt_log.Text.Length;
            txt_log.SelectionLength = 0;

            switch (messageType)
            {
              case DiagnosticMessageType.Trace:
                txt_log.SelectionColor = Color.DimGray;
                break;

              case DiagnosticMessageType.Info:
                txt_log.SelectionColor = Color.Blue;
                break;

              case DiagnosticMessageType.Warn:
                txt_log.SelectionColor = Color.FromArgb(191, 79, 0);
                break;

              case DiagnosticMessageType.Error:
                txt_log.SelectionColor = Color.DarkRed;
                break;
            }

            txt_log.AppendText(message);
            txt_log.AppendText(Environment.NewLine);

            txt_log.ScrollToCaret();
              });
        }
コード例 #12
0
ファイル: DeployCommand.cs プロジェクト: spawluk/UberDeployer
 protected void LogMessage(string message, DiagnosticMessageType messageType)
 {
     _log.DebugIfEnabled(() => string.Format("{0}: {1}", messageType, message));
 }
コード例 #13
0
        public void LogMessage(Guid uniqueClientId, DiagnosticMessageType messageType, string message)
        {
            if (uniqueClientId == Guid.Empty)
              {
            throw new ArgumentException("Argument can't be Guid.Empty.", "uniqueClientId");
              }

              if (string.IsNullOrEmpty(message))
              {
            throw new ArgumentException("Argument can't be null nor empty.", "message");
              }

              lock (_mutex)
              {
            List<DiagnosticMessage> diagnosticMessages;

            if (!_diagnosticMessagesByClientId.TryGetValue(uniqueClientId, out diagnosticMessages))
            {
              diagnosticMessages = new List<DiagnosticMessage>();
              _diagnosticMessagesByClientId.Add(uniqueClientId, diagnosticMessages);
            }

            long messageId = ++_prevMessageId;

            diagnosticMessages.Add(
              new DiagnosticMessage(
            messageId,
            DateTime.UtcNow,
            messageType,
            message));
              }
        }
コード例 #14
0
 protected void LogMessage(string message, DiagnosticMessageType messageType)
 {
     _log.DebugIfEnabled(() => string.Format("{0}: {1}", messageType, message));
 }
コード例 #15
0
 protected void LogMessage(string message, DiagnosticMessageType messageType)
 {
     OutputWriter.WriteLine("[{0}] {1}", messageType.ToString(), message);
 }