Beispiel #1
0
            public FilterComboBox(LogLevel activeFilter = LogLevel.Info)
            {
                foreach (var item in logLevels)
                {
                    base.Items.Add(item.GetName());
                }

                base.SelectedKey           = activeFilter.GetName();
                base.SelectedIndexChanged += (sender, e) => OnFilterChanged(base.SelectedIndex);
            }
Beispiel #2
0
        private void WriteOutput(LogLevel level, ConsoleColor color, string output, params object[] args)
        {
            var logLevel = level.GetName();

            Console.ForegroundColor = color;

            // Prepend log level to each line of the output
            var lines = output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var line in lines)
            {
                var formattedLine = FormatLine(line, args);
                Console.WriteLine("{0,-15}{1}", "[" + logLevel + "]", formattedLine);
            }

            Console.ResetColor();
        }