public PatientController(IConfiguration configuration, ILoggingService loggingService, IPatientManager patientManager) : base(configuration) { _logger = loggingService.GetLogger <PatientController>(nameof(PatientController)); _patientManager = patientManager; }
private const int ABSOLUTE_EXPIRATION_DEFAULT = 320; // default to 4 hour if not configured public CacheProvider(IConfiguration configuration, IDistributedCache cache, ILoggingService loggingService) { _logger = loggingService.GetLogger <CacheProvider>(nameof(CacheProvider)); _configuration = configuration; _cache = cache; }
public LocationController(IConfiguration configuration, ILoggingService loggingService, ILocationManager locationManager) : base(configuration) { _logger = loggingService.GetLogger <LocationController>(nameof(LocationController)); _locationManager = locationManager; }
/// <summary> /// Initializes a new instance of the <see cref="PlacesRepository"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="loggingService">The logging service.</param> /// <exception cref="ArgumentNullException"> /// context /// or /// loggingService /// </exception> public PlacesRepository(ApplicationDbContext context, ILoggingService loggingService) { if (context == null) { throw new ArgumentNullException(nameof(context)); } this.context = context; this.logger = loggingService?.GetLogger <PlacesRepository>(); }
/// <summary> /// Initializes a new instance of the <see cref="ManagementApiController"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="loggingService">The logging service.</param> /// <exception cref="System.ArgumentNullException"> /// context /// or /// loggingService /// </exception> public ManagementApiController(ApplicationDbContext context, ILoggingService loggingService) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (loggingService == null) { throw new ArgumentNullException(nameof(loggingService)); } this.context = context; this.logger = loggingService.GetLogger <ManagementApiController>(); }
public async Task Invoke(HttpContext context, ILoggingService loggingService) { try { var stopwatch = new Stopwatch(); StringValues contextId = GetContextId(context); StringValues correlationId = GetCorrelationId(context, contextId); StringValues applicationId = GetApplicationId(context); ConcurrentDictionary <string, object> dict = GetDictionary(contextId, correlationId, applicationId); if (context.Request.Path.HasValue) { dict.TryAdd(Constants.Headers.ROUTE, context.Request.Path.Value); } string ipV4Address = context.Connection?.RemoteIpAddress?.MapToIPv4().ToString(); using (loggingService.ConfigureLoggingAsync(dict)) { stopwatch.Start(); var logger = loggingService.GetLogger <LoggingMiddleware>(nameof(LoggingMiddleware)); using (logger.BeginScope(new Dictionary <string, object> { ["clientIpAddress"] = ipV4Address })) { logger.LogInformation($"Processing Http request from URL: {context.Request.Path.Value}"); } await next(context).ConfigureAwait(false); stopwatch.Stop(); logger.LogInformation("Finished processing Http request to URL: {URL}. HttpMethod: {HttpMethod}. Duration: {RequestDuration}", context.Request.Path.Value, context.Request.Method, stopwatch.ElapsedMilliseconds); } } catch (Exception e) { throw; } }
/// <summary> /// Initializes a new instance of the <see cref="AnalyticsController"/> class. /// </summary> /// <param name="workItemsRepository">The work items repository.</param> /// <param name="loggingService">The logging service.</param> /// <exception cref="System.ArgumentNullException"> /// workItemsRepository /// or /// loggingService /// </exception> public AnalyticsController( IWorkItemsRepository workItemsRepository, ILoggingService loggingService) { if (workItemsRepository == null) { throw new ArgumentNullException(nameof(workItemsRepository)); } if (loggingService == null) { throw new ArgumentNullException(nameof(loggingService)); } this.workItemsRepository = workItemsRepository; this.logger = loggingService.GetLogger <AnalyticsController>(); }
/// <summary> /// Initializes a new instance of the <see cref="TelephoneNumbersRepository"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="loggingService">The logging service.</param> /// <exception cref="ArgumentNullException"> /// context /// or /// loggingService /// </exception> public TelephoneNumbersRepository( ApplicationDbContext context, ILoggingService loggingService) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (loggingService == null) { throw new ArgumentNullException(nameof(loggingService)); } this.context = context; this.logger = loggingService.GetLogger <TelephoneNumbersRepository>(); }
/// <summary> /// Initializes a new instance of the <see cref="WorkItemsController"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="workItemsRepository">The work items repository.</param> /// <param name="loggingService">The logging service.</param> /// <exception cref="System.ArgumentNullException"> /// context /// or /// workItemsRepository /// or /// customersRepository /// </exception> public WorkItemsController( ApplicationDbContext context, IWorkItemsRepository workItemsRepository, ILoggingService loggingService) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (workItemsRepository == null) { throw new ArgumentNullException(nameof(workItemsRepository)); } this.context = context; this.workItemsRepository = workItemsRepository; this.logger = loggingService?.GetLogger <WorkItemsController>(); }
/// <summary> /// Initializes a new instance of the <see cref="CustomersController"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="customerService">The customer service.</param> /// <param name="loggingService">The logging service.</param> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="System.ArgumentNullException"> /// context /// or /// customerService /// or /// loggingService /// </exception> public CustomersController(ApplicationDbContext context, ICustomerService customerService, ILoggingService loggingService) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (customerService == null) { throw new ArgumentNullException(nameof(customerService)); } if (loggingService == null) { throw new ArgumentNullException(nameof(loggingService)); } this.context = context; this.customerService = customerService; this.logger = loggingService?.GetLogger <CustomersController>(); }
public DummyService(IConfiguration configuration, ILoggingService loggingService, IHttpContextAccessor httpContextAccessor, IApiClient apiClient) : base(configuration, apiClient, httpContextAccessor) { _logger = loggingService.GetLogger <DummyService>(nameof(DummyService)); }
public WebApiController(IRepositoryService repositoryService, IMappingService mappingService, ILoggingService loggingService) { Repository = repositoryService; Mapper = mappingService; Logger = loggingService.GetLogger(GetType()); }