Implemented logging. To complete the logging implementation I have to log the flow to the log file #16

This commit is contained in:
amazing-username
2019-05-05 12:09:19 -04:00
parent 649d2c75a3
commit 4a385af3b5
6 changed files with 126 additions and 52 deletions
+37 -33
View File
@@ -18,6 +18,9 @@ using Microsoft.EntityFrameworkCore;
using MySql.Data;
using MySql.Data.EntityFrameworkCore.Extensions;
using MySql.Data.MySqlClient;
using NLog;
using NLog.Web;
using NLog.Web.AspNetCore;
using Icarus.Authorization;
using Icarus.Authorization.Handlers;
@@ -25,18 +28,18 @@ using Icarus.Models.Context;
namespace Icarus
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddSingleton<IConfiguration>(Configuration);
@@ -80,34 +83,35 @@ namespace Icarus
var connString = Configuration.GetConnectionString("DefaultConnection");
services.Add(new ServiceDescriptor(typeof(MusicStoreContext),
new MusicStoreContext(Configuration
.GetConnectionString("DefaultConnection"))));
services.Add(new ServiceDescriptor(typeof(UserStoreContext),
new UserStoreContext(Configuration
.GetConnectionString("DefaultConnection"))));
services.Add(new ServiceDescriptor(typeof(MusicStoreContext),
new MusicStoreContext(Configuration
.GetConnectionString("DefaultConnection"))));
services.Add(new ServiceDescriptor(typeof(UserStoreContext),
new UserStoreContext(Configuration
.GetConnectionString("DefaultConnection"))));
services.AddDbContext<SongContext>(options => options.UseMySQL(connString));
services.AddDbContext<UserContext>(options => options.UseMySQL(connString));
}
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseMvc();
}
}
app.UseHttpsRedirection();
app.UseMvc();
}
}
}