1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00
Teknik/BillingService/Logger.cs
2022-08-14 17:32:48 -07:00

36 lines
860 B
C#

using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.BillingService
{
internal class Logger : ILogger
{
private readonly TextWriter _textWriter;
public Logger(TextWriter textWriter)
{
_textWriter = textWriter;
}
public IDisposable BeginScope<TState>(TState state)
{
return null;
}
public bool IsEnabled(LogLevel logLevel)
{
return true;
}
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
_textWriter.WriteLine($"[{logLevel}] {formatter(state, exception)}");
}
}
}