Ejemplo n.º 1
0
        public void Configure
        (
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory,
            SharedInterface.ILogger logger,
            IApplicationLifetime appLifetime,
            IApiVersionDescriptionProvider provider,
            BedrockConfiguration bedrockConfiguration
        )
        {
            AddLogging(loggerFactory, logger);

            app.UseHttpException();

            app.UseCors("CorsPolicy");

            if (IsAuthenticationEnabled)
            {
                app.UseAuthentication();
                app.UseMiddleware <SetUserMiddleware>(new PostAuthenticationMiddlewareOptions(new ClaimTypeAad()));
            }

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            AddSwaggerGen(app, provider);

            appLifetime.ApplicationStopped.Register(() => ApplicationContainer.Dispose());
        }
Ejemplo n.º 2
0
 public LoggerProvider(Func <string, LogLevel, bool> filter, SharedInterface.ILogger internalLogger)
 {
     _filter         = filter;
     _internalLogger = internalLogger;
 }
Ejemplo n.º 3
0
 public EfCoreFilteredLogger(BedrockConfiguration bedrockConfiguration, SharedInterface.ILogger internalLogger = null)
 {
     BedrockConfiguration = bedrockConfiguration;
     _internalLogger      = internalLogger;
 }
 public static ILoggerFactory AddLogger(this ILoggerFactory factory, SharedInterface.ILogger logger, LogLevel minLevel)
 {
     return(AddLogger(factory, logger, (_, logLevel) => logLevel >= minLevel));
 }
 public static ILoggerFactory AddLogger(this ILoggerFactory factory, SharedInterface.ILogger logger, Func <string, LogLevel, bool> filter = null)
 {
     factory.AddProvider(new LoggerProvider(filter, logger));
     return(factory);
 }
Ejemplo n.º 6
0
 private void AddLogging(ILoggerFactory loggerFactory, SharedInterface.ILogger logger)
 {
     loggerFactory.AddConsole(Configuration.GetSection("Logging"));
     loggerFactory.AddDebug();
     loggerFactory.AddLogger(logger, LogLevel.Error);
 }
Ejemplo n.º 7
0
 public Logger(string categoryName, Func <string, LogLevel, bool> filter, SharedInterface.ILogger internalLogger)
 {
     _categoryName   = categoryName;
     _filter         = filter;
     _internalLogger = internalLogger;
 }