File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 5
5
using Microsoft . AspNetCore . Mvc . ApiExplorer ;
6
6
using Microsoft . Extensions . Configuration ;
7
7
using Microsoft . Extensions . DependencyInjection ;
8
+ using Microsoft . Extensions . Logging ;
8
9
using Newtonsoft . Json . Serialization ;
10
+ using Serilog ;
9
11
using Supermarket . Extensions ;
10
12
using Supermarket . Resources ;
11
13
@@ -15,6 +17,8 @@ public class Startup
15
17
{
16
18
public Startup ( IConfiguration configuration )
17
19
{
20
+ //Initialize Serilog configuration
21
+ Log . Logger = new LoggerConfiguration ( ) . ReadFrom . Configuration ( configuration ) . CreateLogger ( ) ;
18
22
Configuration = configuration ;
19
23
}
20
24
@@ -58,8 +62,10 @@ public void ConfigureServices(IServiceCollection services)
58
62
}
59
63
60
64
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
61
- public void Configure ( IApplicationBuilder app , IHostingEnvironment env , IApiVersionDescriptionProvider provider )
65
+ public void Configure ( IApplicationBuilder app , IHostingEnvironment env ,
66
+ IApiVersionDescriptionProvider provider , ILoggerFactory loggerFactory )
62
67
{
68
+ loggerFactory . AddSerilog ( ) ;
63
69
if ( env . IsDevelopment ( ) )
64
70
{
65
71
app . UseDeveloperExceptionPage ( ) ;
You can’t perform that action at this time.
0 commit comments