void RenderOutputTemplateTextToken(
     MessageTemplateToken outputToken,
     IReadOnlyDictionary <string, LogEventPropertyValue> outputProperties)
 {
     Console.ForegroundColor = Punctuation;
     outputToken.Render(outputProperties, Console.Out, _formatProvider);
 }
        void RenderExceptionToken(Palette palette, MessageTemplateToken outputToken, IReadOnlyDictionary <string, LogEventPropertyValue> outputProperties, TextWriter output)
        {
            var sw = new StringWriter();

            outputToken.Render(outputProperties, sw, _formatProvider);
            var    lines = new StringReader(sw.ToString());
            string nextLine;

            while ((nextLine = lines.ReadLine()) != null)
            {
                if (nextLine.StartsWith(StackFrameLinePrefix))
                {
                    SetBaseColors(palette);
                }
                else
                {
                    SetHighlightColors(palette);
                }
                output.WriteLine(nextLine);
            }
        }
        void RenderLevelToken(
            LogEventLevel level,
            MessageTemplateToken token,
            IReadOnlyDictionary <string, LogEventPropertyValue> properties,
            TextWriter outputStream)
        {
            LevelFormat format;

            if (!_levels.TryGetValue(level, out format))
            {
                format = _levels[LogEventLevel.Warning];
            }

            SysConsole.ForegroundColor = format.Color;

            if (level == LogEventLevel.Error || level == LogEventLevel.Fatal)
            {
                SysConsole.BackgroundColor = format.Color;
                SysConsole.ForegroundColor = ConsoleColor.White;
            }

            token.Render(properties, outputStream);
            SysConsole.ResetColor();
        }
 void RenderOutputToken(Palette palette, MessageTemplateToken outputToken, IReadOnlyDictionary <string, LogEventPropertyValue> outputProperties, TextWriter output)
 {
     SetBaseColors(palette);
     outputToken.Render(outputProperties, output, _formatProvider);
 }
示例#5
0
 void RenderOutputToken(Palette palette, MessageTemplateToken outputToken, IPropertyDictionary outputProperties, TextWriter output)
 {
     SetBaseColors(palette);
     outputToken.Render(outputProperties, output, _formatProvider);
 }