Improved logging in server components

This commit is contained in:
2025-08-02 21:54:58 +02:00
parent 2e4c933fbe
commit 7c2bc9d19b
7 changed files with 50 additions and 26 deletions

View File

@@ -17,22 +17,24 @@ public class DockerConsole : IConsole
private readonly ConcurrentList<string> OutputCache = new();
private readonly DockerClient DockerClient;
private readonly ILogger<DockerConsole> Logger;
private readonly ILogger Logger;
private readonly ServerContext Context;
private MultiplexedStream? CurrentStream;
private CancellationTokenSource Cts = new();
private const string MlPrefix = "\x1b[1;38;2;200;90;200mM\x1b[1;38;2;204;110;230mo\x1b[1;38;2;170;130;245mo\x1b[1;38;2;140;150;255mn\x1b[1;38;2;110;180;255ml\x1b[1;38;2;100;200;255mi\x1b[1;38;2;100;220;255mg\x1b[1;38;2;120;235;255mh\x1b[1;38;2;140;250;255mt\x1b[0m \x1b[3;38;2;200;200;200m{0}\x1b[0m\n\r";
private const string MlPrefix =
"\x1b[1;38;2;200;90;200mM\x1b[1;38;2;204;110;230mo\x1b[1;38;2;170;130;245mo\x1b[1;38;2;140;150;255mn\x1b[1;38;2;110;180;255ml\x1b[1;38;2;100;200;255mi\x1b[1;38;2;100;220;255mg\x1b[1;38;2;120;235;255mh\x1b[1;38;2;140;250;255mt\x1b[0m \x1b[3;38;2;200;200;200m{0}\x1b[0m\n\r";
public DockerConsole(
ServerContext context,
DockerClient dockerClient,
ILogger<DockerConsole> logger)
ILoggerFactory loggerFactory
)
{
Context = context;
DockerClient = dockerClient;
Logger = logger;
Logger = loggerFactory.CreateLogger($"Servers.Instance.{context.Configuration.Id}.{nameof(DockerConsole)}");
}
public Task Initialize()