aspnetcore/test/WebSites/LoggingWebSite/Startup.cs

48 lines
1.4 KiB
C#

// Copyright (c) Microsoft Open Technologies, Inc. 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.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace LoggingWebSite
{
public class Startup
{
public void Configure(IApplicationBuilder app)
{
var configuration = app.GetTestConfiguration();
app.UseServices(services =>
{
services.AddElm(options =>
{
// We want to log for all log levels and loggers
options.Filter = (loggerName, logLevel) => true;
});
services.AddMvc(configuration);
});
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?}");
});
}
}
}