public LuccaExceptionHandlerMiddleware(RequestDelegate next, ILoggerFactory loggerFactory, IExceptionQualifier filters, IOptions <LuccaExceptionHandlerOption> options) { _next = next; _filter = filters; _options = options; _logger = loggerFactory.CreateLogger <LuccaExceptionHandlerMiddleware>(); }
public LuccaLogger(string categoryName, IHttpContextParser httpContextAccessor, Logger nloLogger, LuccaLoggerOptions options, LogExtractor logExtractor, IExceptionQualifier filters, IExceptionalWrapper exceptionalWrapper, string appName) { _categoryName = categoryName; _httpContextWrapper = httpContextAccessor; _nloLogger = nloLogger; _logExtractor = logExtractor; _options = options; _filters = filters; _exceptionalWrapper = exceptionalWrapper; _appName = appName; }
public LuccaLogsProvider(IOptionsMonitor <LuccaLoggerOptions> options, IHttpContextParser httpContextAccessor, IExceptionQualifier filters, IExceptionalWrapper exceptionalWrapper, IEnumerable <ILogDetailsExtractor> logDetailsExtractors) { _options = options; _httpContextAccessor = httpContextAccessor; _filters = filters; _exceptionalWrapper = exceptionalWrapper; _logDetailsExtractors = logDetailsExtractors; _changeListener = options.OnChange((o, name) => { PropagateOptions(o); }); PropagateOptions(_options.CurrentValue); }
private void Handle(ExceptionHandlerContext context) { IExceptionQualifier efilter = context.RequestContext.Configuration.DependencyResolver.GetService(typeof(IExceptionQualifier)) as IExceptionQualifier; if (efilter == null) { return; } string message = efilter.DisplayExceptionDetails(context.Exception) ? context.Exception.Message : efilter.GenericErrorMessage; context.Result = new TextPlainErrorResult { Request = context.ExceptionContext.Request, Content = message }; }