Skip to content

Instantly share code, notes, and snippets.

@CoreProgramm
Created April 30, 2020 13:45
Show Gist options
  • Save CoreProgramm/c23502c2dc73b63bfff244880b10af89 to your computer and use it in GitHub Desktop.
Save CoreProgramm/c23502c2dc73b63bfff244880b10af89 to your computer and use it in GitHub Desktop.
Custom Middleware
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logFactory)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseCustomLoggerMiddleware();
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World check from Run method!");
});
logFactory.AddFile("Logs/myapp-{Date}.txt");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment