Skip to content

Commit

Permalink
Add fluent configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
CZEMacLeod committed Aug 26, 2024
1 parent ed2687b commit 4f934a9
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Globalization;

namespace C3D.Extensions.Xunit.Logging;

public static class XunitLoggerOptionsExtensions {
public static XunitLoggerOptions WithTimeStamp(this XunitLoggerOptions options, XunitLoggerTimeStamp timeStamp)
{
options.TimeStamp = timeStamp;
return options;
}

public static XunitLoggerOptions WithTimeStampFormat(this XunitLoggerOptions options, string timeStampFormat)
{
options.TimeStampFormat = timeStampFormat;
return options;
}

public static XunitLoggerOptions UseTimeProvider(this XunitLoggerOptions options, TimeProvider timeProvider)
{
options.GetUtcNow = timeProvider.GetUtcNow;
return options;
}

public static XunitLoggerOptions Restart(this XunitLoggerOptions options)
{
options.LogStart = options.GetUtcNow();
return options;
}

public static XunitLoggerOptions UseCulture(this XunitLoggerOptions options, CultureInfo culture)
{
options.Culture = culture;
return options;
}
}

0 comments on commit 4f934a9

Please sign in to comment.