1
0
mirror of synced 2024-11-24 01:33:50 +00:00
Tapeti/Tapeti.Serilog/TapetiSeriLogger.cs

47 lines
1.5 KiB
C#

using System;
using ISeriLogger = Serilog.ILogger;
// ReSharper disable UnusedMember.Global
namespace Tapeti.Serilog
{
public class TapetiSeriLogger: ILogger
{
private readonly ISeriLogger seriLogger;
public TapetiSeriLogger(ISeriLogger seriLogger)
{
this.seriLogger = seriLogger;
}
public void Connect(TapetiConnectionParams connectionParams)
{
seriLogger.Information("Tapeti: trying to connect to {host}:{port}/{virtualHost}",
connectionParams.HostName,
connectionParams.Port,
connectionParams.VirtualHost);
}
public void ConnectFailed(TapetiConnectionParams connectionParams, Exception exception)
{
seriLogger.Error(exception, "Tapeti: could not connect to {host}:{port}/{virtualHost}",
connectionParams.HostName,
connectionParams.Port,
connectionParams.VirtualHost);
}
public void ConnectSuccess(TapetiConnectionParams connectionParams)
{
seriLogger.Information("Tapeti: successfully connected to {host}:{port}/{virtualHost}",
connectionParams.HostName,
connectionParams.Port,
connectionParams.VirtualHost);
}
public void HandlerException(Exception e)
{
seriLogger.Error(e, "Tapeti: exception in message handler");
}
}
}