2018-08-30 13:53:16 +00:00
|
|
|
|
using System;
|
|
|
|
|
using ISeriLogger = Serilog.ILogger;
|
|
|
|
|
|
|
|
|
|
namespace Tapeti.Serilog
|
|
|
|
|
{
|
|
|
|
|
public class TapetiSeriLogger: ILogger
|
|
|
|
|
{
|
|
|
|
|
private readonly ISeriLogger seriLogger;
|
|
|
|
|
|
|
|
|
|
public TapetiSeriLogger(ISeriLogger seriLogger)
|
|
|
|
|
{
|
|
|
|
|
this.seriLogger = seriLogger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Connect(TapetiConnectionParams connectionParams)
|
|
|
|
|
{
|
2019-01-08 15:36:52 +00:00
|
|
|
|
seriLogger.Information("Tapeti: trying to connect to {host}:{port}/{virtualHost}",
|
|
|
|
|
connectionParams.HostName,
|
|
|
|
|
connectionParams.Port,
|
|
|
|
|
connectionParams.VirtualHost);
|
2018-08-30 13:53:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-08 15:36:52 +00:00
|
|
|
|
public void ConnectFailed(TapetiConnectionParams connectionParams, Exception exception)
|
2018-08-30 13:53:16 +00:00
|
|
|
|
{
|
2019-01-08 15:36:52 +00:00
|
|
|
|
seriLogger.Error(exception, "Tapeti: could not connect to {host}:{port}/{virtualHost}",
|
|
|
|
|
connectionParams.HostName,
|
|
|
|
|
connectionParams.Port,
|
|
|
|
|
connectionParams.VirtualHost);
|
2018-08-30 13:53:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ConnectSuccess(TapetiConnectionParams connectionParams)
|
|
|
|
|
{
|
2019-01-08 15:36:52 +00:00
|
|
|
|
seriLogger.Information("Tapeti: successfully connected to {host}:{port}/{virtualHost}",
|
|
|
|
|
connectionParams.HostName,
|
|
|
|
|
connectionParams.Port,
|
|
|
|
|
connectionParams.VirtualHost);
|
2018-08-30 13:53:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void HandlerException(Exception e)
|
|
|
|
|
{
|
2019-01-08 15:36:52 +00:00
|
|
|
|
seriLogger.Error(e, "Tapeti: exception in message handler");
|
2018-08-30 13:53:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|