|
|
@ -15,8 +15,14 @@ namespace Squidex.Infrastructure.Log.Internal |
|
|
{ |
|
|
{ |
|
|
public class AnsiLogConsole : IConsole |
|
|
public class AnsiLogConsole : IConsole |
|
|
{ |
|
|
{ |
|
|
|
|
|
private readonly bool logToStdError; |
|
|
private readonly StringBuilder outputBuilder = new StringBuilder(); |
|
|
private readonly StringBuilder outputBuilder = new StringBuilder(); |
|
|
|
|
|
|
|
|
|
|
|
public AnsiLogConsole(bool logToStdError) |
|
|
|
|
|
{ |
|
|
|
|
|
this.logToStdError = logToStdError; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void WriteLine(SemanticLogLevel level, string message) |
|
|
public void WriteLine(SemanticLogLevel level, string message) |
|
|
{ |
|
|
{ |
|
|
if (level >= SemanticLogLevel.Error) |
|
|
if (level >= SemanticLogLevel.Error) |
|
|
@ -27,7 +33,14 @@ namespace Squidex.Infrastructure.Log.Internal |
|
|
outputBuilder.AppendLine(); |
|
|
outputBuilder.AppendLine(); |
|
|
outputBuilder.Clear(); |
|
|
outputBuilder.Clear(); |
|
|
|
|
|
|
|
|
Console.Error.Write(outputBuilder.ToString()); |
|
|
if (logToStdError) |
|
|
|
|
|
{ |
|
|
|
|
|
Console.Error.Write(outputBuilder.ToString()); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Console.Out.WriteLine(outputBuilder.ToString()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|