|
|
|
@ -7,7 +7,6 @@ |
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Text; |
|
|
|
|
|
|
|
// ReSharper disable SwitchStatementMissingSomeCases
|
|
|
|
|
|
|
|
@ -16,7 +15,6 @@ namespace Squidex.Infrastructure.Log.Internal |
|
|
|
public class AnsiLogConsole : IConsole |
|
|
|
{ |
|
|
|
private readonly bool logToStdError; |
|
|
|
private readonly StringBuilder outputBuilder = new StringBuilder(); |
|
|
|
|
|
|
|
public AnsiLogConsole(bool logToStdError) |
|
|
|
{ |
|
|
|
@ -25,23 +23,9 @@ namespace Squidex.Infrastructure.Log.Internal |
|
|
|
|
|
|
|
public void WriteLine(SemanticLogLevel level, string message) |
|
|
|
{ |
|
|
|
if (level >= SemanticLogLevel.Error) |
|
|
|
if (level >= SemanticLogLevel.Error && logToStdError) |
|
|
|
{ |
|
|
|
outputBuilder.Append("\x1B[1m\x1B[31m"); |
|
|
|
outputBuilder.Append(message); |
|
|
|
outputBuilder.Append("\x1B[39m\x1B[22m"); |
|
|
|
outputBuilder.AppendLine(); |
|
|
|
|
|
|
|
if (logToStdError) |
|
|
|
{ |
|
|
|
Console.Error.Write(outputBuilder.ToString()); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Console.Out.WriteLine(outputBuilder.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
outputBuilder.Clear(); |
|
|
|
Console.Error.WriteLine(message); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|