Skip to content

Commit

Permalink
fix: log message console color
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih committed Nov 25, 2023
1 parent 2c5d145 commit c6c6c35
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Docfx.Common/Loggers/ConsoleLogListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public void WriteLine(ILogItem item)

message.Append(item.Message);

AnsiConsole.Foreground = consoleColor;
AnsiConsole.Console.Write(new NonBreakingText($"{message}\n"));
AnsiConsole.Console.Write(new NonBreakingText($"{message}\n", new(consoleColor)));
}

public void Dispose()
Expand All @@ -67,9 +66,9 @@ public void Flush()
{
}

class NonBreakingText(string text) : IRenderable
class NonBreakingText(string text, Style style) : IRenderable
{
private readonly Paragraph _paragraph = new(text);
private readonly Paragraph _paragraph = new(text, style);

public Measurement Measure(RenderOptions options, int maxWidth) => ((IRenderable)_paragraph).Measure(options, int.MaxValue);
public IEnumerable<Segment> Render(RenderOptions options, int maxWidth) => ((IRenderable)_paragraph).Render(options, int.MaxValue);
Expand Down

0 comments on commit c6c6c35

Please sign in to comment.