public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { loggerFactory.MinimumLevel = LogLevel.Debug; loggerFactory.AddMyLogger(_basePath); app.Run(async context => { var myClass = context.RequestServices.GetService<MyClass>(); myClass.DoSomething(1); myClass.DoSomething(20); myClass.DoSomething(-20); await context.Response.WriteAsync("Hello World!"); }); }