예제 #1
0
 public void OnStdOut(string line)
 {
     if (line == null)
     {
         throw new ArgumentNullException(nameof(line));
     }
     _stdOut.WriteLine(new Text(line));
 }
예제 #2
0
파일: Log.cs 프로젝트: DevTeam/flow
        private void WriteLine(Text[] message, bool showPrefix, Color color = Color.Default)
        {
            if (message.Length <= 0)
            {
                return;
            }

            for (var i = 0; i < message.Length; i++)
            {
                var item = message[i];
                if (color != Color.Default && item.Color == Color.Default)
                {
                    message[i] = new Text(item.Value, color);
                }
            }

            if (showPrefix)
            {
                var line = new List <Text> {
                    _prefix
                };
                foreach (var text in message)
                {
                    if (text.Value == Text.NewLine.Value)
                    {
                        _stdOut.WriteLine(line.ToArray());
                        line.Clear();
                        line.Add(_emptyPrefix);
                    }
                    else
                    {
                        line.Add(text);
                    }
                }

                if (line.Count > 0)
                {
                    _stdOut.WriteLine(line.ToArray());
                }
            }
            else
            {
                _stdOut.WriteLine(message);
            }
        }
예제 #3
0
 public void OnStdOut(string line)
 {
     if (line == null)
     {
         throw new ArgumentNullException(nameof(line));
     }
     if (!_messageProcessor.ProcessServiceMessages(line, this))
     {
         _stdOut.WriteLine(new Text(line));
     }
 }