コード例 #1
0
 public void Log(string message, ConsoleColor color)
 {
     if (IsActive)
     {
         _console.Write(message + Environment.NewLine, ConvertColor(color), null);
     }
 }
コード例 #2
0
        public void Log(DateTime timestamp, string message, TraceEventType level, string source)
        {
            if (IsActive)
            {
                // Map the type
                var mapped = MapType(level);

                // Check if we should write the message
                if (mapped >= _viewModel.ActiveLevel)
                {
                    _console.Write(
                        String.Format(CultureInfo.CurrentCulture, "[{0:O}][{1}]{2}", timestamp, Shorten(source), message) + Environment.NewLine,
                        ConvertColor(mapped), null);
                }

                // TODO: Allow source filtering?
            }
        }