This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StopwatchMiddleWare | |
{ | |
private readonly RequestDelegate _next; | |
public StopwatchMiddleWare(RequestDelegate next) | |
{ | |
_next = next; | |
} | |
public async Task Invoke(HttpContext context) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Hosting; | |
using Microsoft.Extensions.Logging; | |
namespace HostedServiceSample | |
{ | |
public class SampleHostedService : IHostedService | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Concurrent; | |
namespace LoggingSample; | |
public class ColoredConsoleLoggerConfiguration | |
{ | |
public LogLevel LogLevel { get; set; } = LogLevel.Warning; | |
public int EventId { get; set; } = 0; | |
public ConsoleColor Color { get; set; } = ConsoleColor.Yellow; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
autoReload="true" | |
internalLogLevel="Warn" | |
internalLogFile="C:\git\dotnetconf\001-logging\internal-nlog.txt"> | |
<!-- Load the ASP.NET Core plugin --> | |
<extensions> | |
<add assembly="NLog.Web.AspNetCore"/> |
NewerOlder