예제 #1
0
        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));
        }
예제 #2
0
 public MetricLogger(MetricLoggerOptions options)
 => _serialiser = new Serialiser(new SystemClock(), options);
예제 #3
0
 public Serialiser(ISystemClock systemClock, MetricLoggerOptions options)
 {
     _options     = options;
     _systemClock = systemClock ?? new SystemClock();
 }
예제 #4
0
        public static IServiceCollection AddMetricLogger(this IServiceCollection services, MetricLoggerOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(services.AddSingleton <IMetricLogger>(new MetricLogger(options)));
        }