using Serilog.Events;
using Tapeti.Config;
using Tapeti.Serilog.Middleware;
// ReSharper disable UnusedMember.Global - public API
namespace Tapeti.Serilog
{
///
/// ITapetiConfigBuilder extension for enabling message handler logging.
///
public static class ConfigExtensions
{
///
/// Enables message handler logging.
///
///
/// The time (in milliseconds) a message handler is allowed to run without a warning being logged
/// The default log level when a message handler completes within the elapsedWarningTreshold
///
public static ITapetiConfigBuilder WithMessageHandlerLogging(this ITapetiConfigBuilder config,
double elapsedWarningTreshold = 500, LogEventLevel defaultLevel = LogEventLevel.Debug)
{
config.Use(new MessageHandlerLoggingBindingMiddleware(elapsedWarningTreshold, defaultLevel));
return config;
}
}
}