Skip to content

Commit

Permalink
RemoveAllManifestProcessors, RemoveAllContextLoggers
Browse files Browse the repository at this point in the history
  • Loading branch information
wickedmachinator committed Nov 12, 2024
1 parent 7eccf93 commit 3595714
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
4 changes: 2 additions & 2 deletions EtLast.CommandService/CommandService.RunTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ protected override IExecutionResult RunTasks(string commandId, string moduleName
}
}

if (sessionBuilder.EtlContextLoggerCreators?.Count > 0)
if (sessionBuilder.ContextLoggerCreators?.Count > 0)
{
try
{
foreach (var creator in sessionBuilder.EtlContextLoggerCreators)
foreach (var creator in sessionBuilder.ContextLoggerCreators)
{
var logger = creator?.Invoke();
if (logger != null)
Expand Down
2 changes: 1 addition & 1 deletion EtLast.Hosting/Logging/EtlContextDevToFileLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public static class EtlContextDevToFileLoggerFluent
{
public static ISessionBuilder LogDevToFile(this ISessionBuilder builder, LogSeverity minimumLogLevel = LogSeverity.Debug, int retentionHours = 24 * 31)
{
builder.AddLogger(() => new EtlContextDevToFileLogger(builder.Context, builder.DevLogDirectory, minimumLogLevel, retentionHours));
builder.AddContextLogger(() => new EtlContextDevToFileLogger(builder.Context, builder.DevLogDirectory, minimumLogLevel, retentionHours));
return builder;
}
}
2 changes: 1 addition & 1 deletion EtLast.Hosting/Logging/EtlContextDevToSeqLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static class EtlContextDevToSeqLoggerFluent
{
public static ISessionBuilder LogDevToSeq(this ISessionBuilder session, string url, string apiKey, LogSeverity minimumLogLevel = LogSeverity.Debug)
{
session.AddLogger(() => new EtlContextDevToSeqLogger(session.Context, url, apiKey, minimumLogLevel));
session.AddContextLogger(() => new EtlContextDevToSeqLogger(session.Context, url, apiKey, minimumLogLevel));
return session;
}
}
2 changes: 1 addition & 1 deletion EtLast.Hosting/Logging/EtlContextOpsToFileLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static class EtlContextOpsToFileLoggerFluent
{
public static ISessionBuilder LogOpsToFile(this ISessionBuilder session, int importantFileCount = 30, int infoFileCount = 14)
{
session.AddLogger(() => new EtlContextOpsToFileLogger(session.Context, session.OpsLogDirectory, importantFileCount, infoFileCount));
session.AddContextLogger(() => new EtlContextOpsToFileLogger(session.Context, session.OpsLogDirectory, importantFileCount, infoFileCount));
return session;
}
}
6 changes: 5 additions & 1 deletion EtLast/Session/ISessionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public interface ISessionBuilder
public string OpsLogDirectory { get; }

public ISessionBuilder AddManifestProcessor(Func<IManifestProcessor> manifestProcessor);
public ISessionBuilder AddLogger(Func<IEtlContextLogger> creator);
public ISessionBuilder RemoveAllManifestProcessors();

public ISessionBuilder AddContextLogger(Func<IEtlContextLogger> creator);
public ISessionBuilder RemoveAllContextLoggers();

public ISessionBuilder UseTransactionScopeTimeout(TimeSpan timeout);
}
18 changes: 15 additions & 3 deletions EtLast/Session/SessionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ public class SessionBuilder : ISessionBuilder
public List<Func<IManifestProcessor>> ManifestProcessorCreators { get; } = [];

[EditorBrowsable(EditorBrowsableState.Never)]
public List<Func<IEtlContextLogger>> EtlContextLoggerCreators { get; } = [];
public List<Func<IEtlContextLogger>> ContextLoggerCreators { get; } = [];

public ISessionBuilder AddManifestProcessor(Func<IManifestProcessor> manifestProcessor)
{
ManifestProcessorCreators.Add(manifestProcessor);
return this;
}

public ISessionBuilder AddLogger(Func<IEtlContextLogger> creator)
public ISessionBuilder AddContextLogger(Func<IEtlContextLogger> creator)
{
EtlContextLoggerCreators.Add(creator);
ContextLoggerCreators.Add(creator);
return this;
}

Expand All @@ -30,4 +30,16 @@ public ISessionBuilder UseTransactionScopeTimeout(TimeSpan timeout)
Context.TransactionScopeTimeout = timeout;
return this;
}

public ISessionBuilder RemoveAllManifestProcessors()
{
ManifestProcessorCreators.Clear();
return this;
}

public ISessionBuilder RemoveAllContextLoggers()
{
ContextLoggerCreators.Clear();
return this;
}
}

0 comments on commit 3595714

Please sign in to comment.