aspnetcore/test/WebSites/LoggingWebSite/Startup.cs

50 lines
1.4 KiB
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
using Microsoft.Framework.DependencyInjection;
namespace LoggingWebSite
{
public class Startup
{
// Set up application services
public void ConfigureServices(IServiceCollection services)
{
services.AddElm();
services.ConfigureElm(options =>
{
// We want to log for all log levels and loggers
options.Filter = (loggerName, logLevel) => true;
});
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
app.UseCultureReplacer();
app.Map("/logs", (appBuilder) =>
{
appBuilder.UseMiddleware<ElmLogSerializerMiddleware>();
});
app.UseElmCapture();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action}/{id?}",
defaults: new { controller = "Home", action = "Index" });
routes.MapRoute(
name: "api",
template: "{controller}/{id?}");
});
}
}
}