mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
// ==========================================================================
|
|
// AnsiLogConsole.cs
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex Group
|
|
// All rights reserved.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using System.Text;
|
|
|
|
// ReSharper disable SwitchStatementMissingSomeCases
|
|
|
|
namespace Squidex.Infrastructure.Log.Internal
|
|
{
|
|
public class AnsiLogConsole : IConsole
|
|
{
|
|
private readonly StringBuilder outputBuilder = new StringBuilder();
|
|
|
|
public void WriteLine(SemanticLogLevel level, string message)
|
|
{
|
|
if (level >= SemanticLogLevel.Error)
|
|
{
|
|
outputBuilder.Append("\x1B[1m\x1B[31m");
|
|
outputBuilder.Append(message);
|
|
outputBuilder.Append("\x1B[39m\x1B[22m");
|
|
outputBuilder.AppendLine();
|
|
|
|
Console.Error.Write(outputBuilder.ToString());
|
|
}
|
|
else
|
|
{
|
|
Console.Out.Write(outputBuilder.ToString());
|
|
}
|
|
|
|
outputBuilder.Clear();
|
|
}
|
|
}
|
|
}
|
|
|