public static IServiceCollection AddMetricLogger(this IServiceCollection services, Action <MetricLoggerOptions> configureOptions) { if (configureOptions == null) { throw new ArgumentNullException(nameof(configureOptions)); } var options = new MetricLoggerOptions(); configureOptions.Invoke(options); return(services.AddMetricLogger(options)); }
public MetricLogger(MetricLoggerOptions options) => _serialiser = new Serialiser(new SystemClock(), options);
public Serialiser(ISystemClock systemClock, MetricLoggerOptions options) { _options = options; _systemClock = systemClock ?? new SystemClock(); }
public static IServiceCollection AddMetricLogger(this IServiceCollection services, MetricLoggerOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } return(services.AddSingleton <IMetricLogger>(new MetricLogger(options))); }