Improves plugin log initialization
This commit is contained in:
parent
9e9773f45d
commit
127b7daecc
@ -36,11 +36,11 @@ namespace Core
|
|||||||
private readonly ITimeSet timeSet;
|
private readonly ITimeSet timeSet;
|
||||||
private readonly WorkflowCreator workflowCreator;
|
private readonly WorkflowCreator workflowCreator;
|
||||||
private readonly IFileManager fileManager;
|
private readonly IFileManager fileManager;
|
||||||
private ILog log;
|
private readonly LogPrefixer log;
|
||||||
|
|
||||||
internal PluginTools(ILog log, WorkflowCreator workflowCreator, string fileManagerRootFolder, ITimeSet timeSet)
|
internal PluginTools(ILog log, WorkflowCreator workflowCreator, string fileManagerRootFolder, ITimeSet timeSet)
|
||||||
{
|
{
|
||||||
this.log = log;
|
this.log = new LogPrefixer(log);
|
||||||
this.workflowCreator = workflowCreator;
|
this.workflowCreator = workflowCreator;
|
||||||
this.timeSet = timeSet;
|
this.timeSet = timeSet;
|
||||||
fileManager = new FileManager(log, fileManagerRootFolder);
|
fileManager = new FileManager(log, fileManagerRootFolder);
|
||||||
@ -48,7 +48,7 @@ namespace Core
|
|||||||
|
|
||||||
public void ApplyLogPrefix(string prefix)
|
public void ApplyLogPrefix(string prefix)
|
||||||
{
|
{
|
||||||
log = new LogPrefixer(log, prefix);
|
log.Prefix = prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHttp CreateHttp(Action<HttpClient> onClientCreated)
|
public IHttp CreateHttp(Action<HttpClient> onClientCreated)
|
||||||
|
@ -3,14 +3,21 @@
|
|||||||
public class LogPrefixer : ILog
|
public class LogPrefixer : ILog
|
||||||
{
|
{
|
||||||
private readonly ILog backingLog;
|
private readonly ILog backingLog;
|
||||||
private readonly string prefix;
|
|
||||||
|
public LogPrefixer(ILog backingLog)
|
||||||
|
{
|
||||||
|
this.backingLog = backingLog;
|
||||||
|
}
|
||||||
|
|
||||||
public LogPrefixer(ILog backingLog, string prefix)
|
public LogPrefixer(ILog backingLog, string prefix)
|
||||||
{
|
{
|
||||||
this.backingLog = backingLog;
|
this.backingLog = backingLog;
|
||||||
this.prefix = prefix;
|
Prefix = prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Prefix { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
public LogFile CreateSubfile(string ext = "log")
|
public LogFile CreateSubfile(string ext = "log")
|
||||||
{
|
{
|
||||||
return backingLog.CreateSubfile(ext);
|
return backingLog.CreateSubfile(ext);
|
||||||
@ -18,17 +25,17 @@
|
|||||||
|
|
||||||
public void Debug(string message = "", int skipFrames = 0)
|
public void Debug(string message = "", int skipFrames = 0)
|
||||||
{
|
{
|
||||||
backingLog.Debug(prefix + message, skipFrames);
|
backingLog.Debug(Prefix + message, skipFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Error(string message)
|
public void Error(string message)
|
||||||
{
|
{
|
||||||
backingLog.Error(prefix + message);
|
backingLog.Error(Prefix + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Log(string message)
|
public void Log(string message)
|
||||||
{
|
{
|
||||||
backingLog.Log(prefix + message);
|
backingLog.Log(Prefix + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddStringReplace(string from, string to)
|
public void AddStringReplace(string from, string to)
|
||||||
|
@ -7,7 +7,7 @@ namespace CodexPlugin
|
|||||||
{
|
{
|
||||||
public class CodexContainerRecipe : ContainerRecipeFactory
|
public class CodexContainerRecipe : ContainerRecipeFactory
|
||||||
{
|
{
|
||||||
private const string DefaultDockerImage = "codexstorage/nim-codex:sha-455b95d-dist-tests";
|
private const string DefaultDockerImage = "codexstorage/nim-codex:sha-cd280d4-dist-tests";
|
||||||
public const string ApiPortTag = "codex_api_port";
|
public const string ApiPortTag = "codex_api_port";
|
||||||
public const string ListenPortTag = "codex_listen_port";
|
public const string ListenPortTag = "codex_listen_port";
|
||||||
public const string MetricsPortTag = "codex_metrics_port";
|
public const string MetricsPortTag = "codex_metrics_port";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user