From ded6cb7b38e6bacfe5f6ecc9a7e193461c14072a Mon Sep 17 00:00:00 2001 From: Hans Mulder Date: Thu, 30 Aug 2018 15:53:16 +0200 Subject: [PATCH] Added project/package for using serilog with Tapeti --- Tapeti.Serilog/Tapeti.Serilog.csproj | 15 +++++++++++ Tapeti.Serilog/Tapeti.Serilog.nuspec | 24 +++++++++++++++++ Tapeti.Serilog/TapetiSeriLogger.cs | 39 ++++++++++++++++++++++++++++ Tapeti.sln | 8 +++++- 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 Tapeti.Serilog/Tapeti.Serilog.csproj create mode 100644 Tapeti.Serilog/Tapeti.Serilog.nuspec create mode 100644 Tapeti.Serilog/TapetiSeriLogger.cs diff --git a/Tapeti.Serilog/Tapeti.Serilog.csproj b/Tapeti.Serilog/Tapeti.Serilog.csproj new file mode 100644 index 0000000..ec64a23 --- /dev/null +++ b/Tapeti.Serilog/Tapeti.Serilog.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + + + + + + + + diff --git a/Tapeti.Serilog/Tapeti.Serilog.nuspec b/Tapeti.Serilog/Tapeti.Serilog.nuspec new file mode 100644 index 0000000..6e7bdcd --- /dev/null +++ b/Tapeti.Serilog/Tapeti.Serilog.nuspec @@ -0,0 +1,24 @@ + + + + X2Software.Tapeti.Serilog + $version$ + Tapeti Serilog + Hans Mulder + Hans Mulder + https://raw.githubusercontent.com/MvRens/Tapeti/master/UNLICENSE + https://github.com/MvRens/Tapeti + https://raw.githubusercontent.com/MvRens/Tapeti/master/resources/icons/Tapeti.SimpleInjector.png + false + Serilog integration package for Tapeti + + rabbitmq tapeti simpleinjector serilog + + + + + + + + + \ No newline at end of file diff --git a/Tapeti.Serilog/TapetiSeriLogger.cs b/Tapeti.Serilog/TapetiSeriLogger.cs new file mode 100644 index 0000000..4138f6c --- /dev/null +++ b/Tapeti.Serilog/TapetiSeriLogger.cs @@ -0,0 +1,39 @@ +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) + { + // method not yet used in Tapeti + seriLogger.Information("Trying to connected to " + connectionParams.HostName); + } + + public void ConnectFailed(TapetiConnectionParams connectionParams) + { + // method not yet used in Tapeti + seriLogger.Error("Could not connect to " + connectionParams.HostName); + + } + + public void ConnectSuccess(TapetiConnectionParams connectionParams) + { + // method not yet used in Tapeti + seriLogger.Information("Succesfull connected to " + connectionParams.HostName); + } + + public void HandlerException(Exception e) + { + seriLogger.Error(e, "Exception handled by Tapeti"); + } + } +} diff --git a/Tapeti.sln b/Tapeti.sln index ad1c189..73f1486 100644 --- a/Tapeti.sln +++ b/Tapeti.sln @@ -17,7 +17,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tapeti.SimpleInjector", "Ta EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", "{1A4B7136-B7DF-41EA-BEA2-E87B4607D420}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tapeti.Tests", "Tapeti.Tests\Tapeti.Tests.csproj", "{334F3715-63CF-4D13-B09A-38E2A616D4F5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tapeti.Tests", "Tapeti.Tests\Tapeti.Tests.csproj", "{334F3715-63CF-4D13-B09A-38E2A616D4F5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tapeti.Serilog", "Tapeti.Serilog\Tapeti.Serilog.csproj", "{43AA5DF3-49D5-4795-A290-D6511502B564}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -57,6 +59,10 @@ Global {334F3715-63CF-4D13-B09A-38E2A616D4F5}.Debug|Any CPU.Build.0 = Debug|Any CPU {334F3715-63CF-4D13-B09A-38E2A616D4F5}.Release|Any CPU.ActiveCfg = Release|Any CPU {334F3715-63CF-4D13-B09A-38E2A616D4F5}.Release|Any CPU.Build.0 = Release|Any CPU + {43AA5DF3-49D5-4795-A290-D6511502B564}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {43AA5DF3-49D5-4795-A290-D6511502B564}.Debug|Any CPU.Build.0 = Debug|Any CPU + {43AA5DF3-49D5-4795-A290-D6511502B564}.Release|Any CPU.ActiveCfg = Release|Any CPU + {43AA5DF3-49D5-4795-A290-D6511502B564}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE