namespace Divergic.Logging.Xunit
{
using System;
using System.Collections.ObjectModel;
using Microsoft.Extensions.Logging;
///
/// The
/// class is used to configure how logging operates.
///
public class LoggingConfig
{
private ILogFormatter _formatter;
private ILogFormatter _scopeFormatter;
///
/// Initializes a new instance of the class.
///
public LoggingConfig()
{
_formatter = new DefaultFormatter(this);
_scopeFormatter = new DefaultScopeFormatter(this);
}
///
/// Gets or sets a custom formatting for rendering log messages to xUnit test output.
///
public ILogFormatter Formatter
{
get => _formatter;
set =>
_formatter = value ?? throw new ArgumentNullException(nameof(value));
}
///
/// Gets or sets whether exceptions thrown while logging outside of the test execution will be ignored.
///
public bool IgnoreTestBoundaryException { get; set; }
///
/// Gets or sets the minimum logging level.
///
public LogLevel LogLevel { get; set; } = LogLevel.Trace;
///
/// Gets or sets a custom formatting for rendering scope beginning and end messages to xUnit test output.
///
public ILogFormatter ScopeFormatter
{
get => _scopeFormatter;
set =>
_scopeFormatter = value ?? throw new ArgumentNullException(nameof(value));
}
///
/// Identifies the number of spaces to use for indenting scopes.
///
public int ScopePaddingSpaces { get; set; } = 3;
///
/// Gets the set of sensitive values that should be filtered out when writing log messages.
///
public Collection SensitiveValues { get; } = new();
}
}