From 2153f630b557607bd049b449bcc13abdb7ae20fe Mon Sep 17 00:00:00 2001 From: Ali Yousefi Date: Mon, 4 Dec 2023 17:12:19 +0330 Subject: [PATCH] move folder and fix naming --- .../EasyMicroservices.Logger.Log4net.csproj | 2 +- .../Log4netExtensions.cs | 0 .../Providers/Log4netProvider.cs | 0 ...services.Logger.DependencyInjection.csproj | 2 +- .../LoggerExtensions.cs | 64 +++++++++++++++++++ .../EasyMicroservices.Logger.NLog.csproj | 2 +- .../NLogExtensions.cs | 2 +- .../Providers/NLogProvider.cs | 0 .../EasyMicroservices.Logger.Serilog.csproj | 2 +- .../Providers/SerilogProvider.cs | 0 .../SerilogExtensions.cs | 2 +- .../BaseProviderAsyncTest.cs | 0 .../BaseProviderTest.cs | 0 .../EasyMicroservices.Logger.Tests.csproj | 0 .../Providers/Log4netProviderTest.cs | 0 .../Providers/NLogProviderTest.cs | 0 .../Providers/SerilogProviderTest.cs | 0 .../EasyMicroservices.Logger.sln | 0 .../LoggerExtensions.cs | 26 -------- .../EasyMicroservices.Logger.csproj | 2 +- .../Interfaces/ILoggerProvider.cs | 0 .../Interfaces/ILoggerProviderAsync.cs | 0 .../Models/ExtractedLogInfo.cs | 0 .../Options/LoggerOption.cs | 0 .../Options/LoggerOptionBuilder.cs | 0 .../Providers/BaseProvider.cs | 0 .../coverage-badge-branch.svg | 0 .../coverage-badge-line.svg | 0 28 files changed, 71 insertions(+), 33 deletions(-) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger. Log4net/EasyMicroservices.Logger.Log4net.csproj (97%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger. Log4net/Log4netExtensions.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger. Log4net/Providers/Log4netProvider.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.DependencyInjection/EasyMicroservices.Logger.DependencyInjection.csproj (97%) create mode 100644 src/CSharp/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.NLog/EasyMicroservices.Logger.NLog.csproj (97%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.NLog/NLogExtensions.cs (87%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.NLog/Providers/NLogProvider.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.Serilog/EasyMicroservices.Logger.Serilog.csproj (97%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.Serilog/Providers/SerilogProvider.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.Serilog/SerilogExtensions.cs (92%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.Tests/BaseProviderAsyncTest.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.Tests/BaseProviderTest.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.Tests/EasyMicroservices.Logger.Tests.csproj (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.Tests/Providers/Log4netProviderTest.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.Tests/Providers/NLogProviderTest.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.Tests/Providers/SerilogProviderTest.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.sln (100%) delete mode 100644 src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs rename src/CSharp/EasyMicroservices.Logger/{EasyMicroservices.Logger => }/EasyMicroservices.Logger.csproj (96%) rename src/CSharp/EasyMicroservices.Logger/{EasyMicroservices.Logger => }/Interfaces/ILoggerProvider.cs (100%) rename src/CSharp/EasyMicroservices.Logger/{EasyMicroservices.Logger => }/Interfaces/ILoggerProviderAsync.cs (100%) rename src/CSharp/EasyMicroservices.Logger/{EasyMicroservices.Logger => }/Models/ExtractedLogInfo.cs (100%) rename src/CSharp/EasyMicroservices.Logger/{EasyMicroservices.Logger => }/Options/LoggerOption.cs (100%) rename src/CSharp/EasyMicroservices.Logger/{EasyMicroservices.Logger => }/Options/LoggerOptionBuilder.cs (100%) rename src/CSharp/EasyMicroservices.Logger/{EasyMicroservices.Logger => }/Providers/BaseProvider.cs (100%) rename src/CSharp/{EasyMicroservices.Logger => }/coverage-badge-branch.svg (100%) rename src/CSharp/{EasyMicroservices.Logger => }/coverage-badge-line.svg (100%) diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger. Log4net/EasyMicroservices.Logger.Log4net.csproj b/src/CSharp/EasyMicroservices.Logger. Log4net/EasyMicroservices.Logger.Log4net.csproj similarity index 97% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger. Log4net/EasyMicroservices.Logger.Log4net.csproj rename to src/CSharp/EasyMicroservices.Logger. Log4net/EasyMicroservices.Logger.Log4net.csproj index cb75f8c..3cb10ad 100644 --- a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger. Log4net/EasyMicroservices.Logger.Log4net.csproj +++ b/src/CSharp/EasyMicroservices.Logger. Log4net/EasyMicroservices.Logger.Log4net.csproj @@ -17,7 +17,7 @@ AnyCPU;x64;x86 EasyMicroservices true - 0.0.0.2 + 0.0.0.3 logger wrapper EasyMicroservices@gmail.com log,logger,logging,log4net diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger. Log4net/Log4netExtensions.cs b/src/CSharp/EasyMicroservices.Logger. Log4net/Log4netExtensions.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger. Log4net/Log4netExtensions.cs rename to src/CSharp/EasyMicroservices.Logger. Log4net/Log4netExtensions.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger. Log4net/Providers/Log4netProvider.cs b/src/CSharp/EasyMicroservices.Logger. Log4net/Providers/Log4netProvider.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger. Log4net/Providers/Log4netProvider.cs rename to src/CSharp/EasyMicroservices.Logger. Log4net/Providers/Log4netProvider.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.DependencyInjection/EasyMicroservices.Logger.DependencyInjection.csproj b/src/CSharp/EasyMicroservices.Logger.DependencyInjection/EasyMicroservices.Logger.DependencyInjection.csproj similarity index 97% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.DependencyInjection/EasyMicroservices.Logger.DependencyInjection.csproj rename to src/CSharp/EasyMicroservices.Logger.DependencyInjection/EasyMicroservices.Logger.DependencyInjection.csproj index eff80c7..3814779 100644 --- a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.DependencyInjection/EasyMicroservices.Logger.DependencyInjection.csproj +++ b/src/CSharp/EasyMicroservices.Logger.DependencyInjection/EasyMicroservices.Logger.DependencyInjection.csproj @@ -17,7 +17,7 @@ AnyCPU;x64;x86 EasyMicroservices true - 0.0.0.1 + 0.0.0.3 logger wrapper EasyMicroservices@gmail.com log,logger,logging diff --git a/src/CSharp/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs b/src/CSharp/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs new file mode 100644 index 0000000..002ef95 --- /dev/null +++ b/src/CSharp/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs @@ -0,0 +1,64 @@ +using EasyMicroservices.Logger.Options; +using System; + +namespace Microsoft.Extensions.DependencyInjection +{ + /// + /// + /// + public static class LoggerExtensions + { + /// + /// + /// + /// + /// + /// + public static IServiceCollection AddLogger(this IServiceCollection services, Action options) + { + return AddLoggerTransient(services, options); + } + + /// + /// + /// + /// + /// + /// + public static IServiceCollection AddLoggerScoped(this IServiceCollection services, Action options) + { + options.ThrowIfNull(nameof(options)); + options(new LoggerOption()); + services.AddScoped(service => LoggerOptionBuilder.GetLogger()); + return services; + } + + /// + /// + /// + /// + /// + /// + public static IServiceCollection AddLoggerTransient(this IServiceCollection services, Action options) + { + options.ThrowIfNull(nameof(options)); + options(new LoggerOption()); + services.AddTransient(service => LoggerOptionBuilder.GetLogger()); + return services; + } + + /// + /// + /// + /// + /// + /// + public static IServiceCollection AddLoggerSingleton(this IServiceCollection services, Action options) + { + options.ThrowIfNull(nameof(options)); + options(new LoggerOption()); + services.AddSingleton(service => LoggerOptionBuilder.GetLogger()); + return services; + } + } +} \ No newline at end of file diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.NLog/EasyMicroservices.Logger.NLog.csproj b/src/CSharp/EasyMicroservices.Logger.NLog/EasyMicroservices.Logger.NLog.csproj similarity index 97% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.NLog/EasyMicroservices.Logger.NLog.csproj rename to src/CSharp/EasyMicroservices.Logger.NLog/EasyMicroservices.Logger.NLog.csproj index 72b173e..ddf160b 100644 --- a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.NLog/EasyMicroservices.Logger.NLog.csproj +++ b/src/CSharp/EasyMicroservices.Logger.NLog/EasyMicroservices.Logger.NLog.csproj @@ -17,7 +17,7 @@ AnyCPU;x64;x86 EasyMicroservices true - 0.0.0.2 + 0.0.0.3 logger wrapper EasyMicroservices@gmail.com log,logger,logging,nlog diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.NLog/NLogExtensions.cs b/src/CSharp/EasyMicroservices.Logger.NLog/NLogExtensions.cs similarity index 87% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.NLog/NLogExtensions.cs rename to src/CSharp/EasyMicroservices.Logger.NLog/NLogExtensions.cs index dbcb4ac..aecf1fc 100644 --- a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.NLog/NLogExtensions.cs +++ b/src/CSharp/EasyMicroservices.Logger.NLog/NLogExtensions.cs @@ -15,7 +15,7 @@ public static class NLogExtensions /// /// /// - public static LoggerOption UseLog4net(this LoggerOption options, NLog.Logger logger) + public static LoggerOption UseNLog(this LoggerOption options, NLog.Logger logger) { options.ThrowIfNull(nameof(options)); logger.ThrowIfNull(nameof(logger)); diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.NLog/Providers/NLogProvider.cs b/src/CSharp/EasyMicroservices.Logger.NLog/Providers/NLogProvider.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.NLog/Providers/NLogProvider.cs rename to src/CSharp/EasyMicroservices.Logger.NLog/Providers/NLogProvider.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Serilog/EasyMicroservices.Logger.Serilog.csproj b/src/CSharp/EasyMicroservices.Logger.Serilog/EasyMicroservices.Logger.Serilog.csproj similarity index 97% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Serilog/EasyMicroservices.Logger.Serilog.csproj rename to src/CSharp/EasyMicroservices.Logger.Serilog/EasyMicroservices.Logger.Serilog.csproj index b4f2f3e..27c470f 100644 --- a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Serilog/EasyMicroservices.Logger.Serilog.csproj +++ b/src/CSharp/EasyMicroservices.Logger.Serilog/EasyMicroservices.Logger.Serilog.csproj @@ -17,7 +17,7 @@ AnyCPU;x64;x86 EasyMicroservices true - 0.0.0.2 + 0.0.0.3 logger wrapper EasyMicroservices@gmail.com log,logger,logging,serilog diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Serilog/Providers/SerilogProvider.cs b/src/CSharp/EasyMicroservices.Logger.Serilog/Providers/SerilogProvider.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Serilog/Providers/SerilogProvider.cs rename to src/CSharp/EasyMicroservices.Logger.Serilog/Providers/SerilogProvider.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Serilog/SerilogExtensions.cs b/src/CSharp/EasyMicroservices.Logger.Serilog/SerilogExtensions.cs similarity index 92% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Serilog/SerilogExtensions.cs rename to src/CSharp/EasyMicroservices.Logger.Serilog/SerilogExtensions.cs index 8b8d4f9..a73842d 100644 --- a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Serilog/SerilogExtensions.cs +++ b/src/CSharp/EasyMicroservices.Logger.Serilog/SerilogExtensions.cs @@ -16,7 +16,7 @@ public static class SerilogExtensions /// /// /// - public static LoggerOption UseLog4net(this LoggerOption options, LoggerConfiguration loggerConfiguration) + public static LoggerOption UseSerilog(this LoggerOption options, LoggerConfiguration loggerConfiguration) { options.ThrowIfNull(nameof(options)); loggerConfiguration.ThrowIfNull(nameof(loggerConfiguration)); diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/BaseProviderAsyncTest.cs b/src/CSharp/EasyMicroservices.Logger.Tests/BaseProviderAsyncTest.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/BaseProviderAsyncTest.cs rename to src/CSharp/EasyMicroservices.Logger.Tests/BaseProviderAsyncTest.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/BaseProviderTest.cs b/src/CSharp/EasyMicroservices.Logger.Tests/BaseProviderTest.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/BaseProviderTest.cs rename to src/CSharp/EasyMicroservices.Logger.Tests/BaseProviderTest.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/EasyMicroservices.Logger.Tests.csproj b/src/CSharp/EasyMicroservices.Logger.Tests/EasyMicroservices.Logger.Tests.csproj similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/EasyMicroservices.Logger.Tests.csproj rename to src/CSharp/EasyMicroservices.Logger.Tests/EasyMicroservices.Logger.Tests.csproj diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/Providers/Log4netProviderTest.cs b/src/CSharp/EasyMicroservices.Logger.Tests/Providers/Log4netProviderTest.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/Providers/Log4netProviderTest.cs rename to src/CSharp/EasyMicroservices.Logger.Tests/Providers/Log4netProviderTest.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/Providers/NLogProviderTest.cs b/src/CSharp/EasyMicroservices.Logger.Tests/Providers/NLogProviderTest.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/Providers/NLogProviderTest.cs rename to src/CSharp/EasyMicroservices.Logger.Tests/Providers/NLogProviderTest.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/Providers/SerilogProviderTest.cs b/src/CSharp/EasyMicroservices.Logger.Tests/Providers/SerilogProviderTest.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.Tests/Providers/SerilogProviderTest.cs rename to src/CSharp/EasyMicroservices.Logger.Tests/Providers/SerilogProviderTest.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.sln b/src/CSharp/EasyMicroservices.Logger.sln similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.sln rename to src/CSharp/EasyMicroservices.Logger.sln diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs b/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs deleted file mode 100644 index 5ec8e3f..0000000 --- a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs +++ /dev/null @@ -1,26 +0,0 @@ -using EasyMicroservices.Logger.Interfaces; -using EasyMicroservices.Logger.Options; -using System; - -namespace Microsoft.Extensions.DependencyInjection -{ - /// - /// - /// - public static class LoggerExtensions - { - /// - /// - /// - /// - /// - /// - public static IServiceCollection AddLogger(this IServiceCollection services, Action options) - { - options.ThrowIfNull(nameof(options)); - options(new LoggerOption()); - services.AddScoped(service => LoggerOptionBuilder.GetLogger()); - return services; - } - } -} \ No newline at end of file diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/EasyMicroservices.Logger.csproj b/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.csproj similarity index 96% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/EasyMicroservices.Logger.csproj rename to src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.csproj index 4fd5a16..f7e1bce 100644 --- a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/EasyMicroservices.Logger.csproj +++ b/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net6.0 EasyMicroservices true - 0.0.0.2 + 0.0.0.3 Logger and Auditing system EasyMicroservice@gmail.com logging,auditing diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Interfaces/ILoggerProvider.cs b/src/CSharp/EasyMicroservices.Logger/Interfaces/ILoggerProvider.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Interfaces/ILoggerProvider.cs rename to src/CSharp/EasyMicroservices.Logger/Interfaces/ILoggerProvider.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Interfaces/ILoggerProviderAsync.cs b/src/CSharp/EasyMicroservices.Logger/Interfaces/ILoggerProviderAsync.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Interfaces/ILoggerProviderAsync.cs rename to src/CSharp/EasyMicroservices.Logger/Interfaces/ILoggerProviderAsync.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Models/ExtractedLogInfo.cs b/src/CSharp/EasyMicroservices.Logger/Models/ExtractedLogInfo.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Models/ExtractedLogInfo.cs rename to src/CSharp/EasyMicroservices.Logger/Models/ExtractedLogInfo.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Options/LoggerOption.cs b/src/CSharp/EasyMicroservices.Logger/Options/LoggerOption.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Options/LoggerOption.cs rename to src/CSharp/EasyMicroservices.Logger/Options/LoggerOption.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Options/LoggerOptionBuilder.cs b/src/CSharp/EasyMicroservices.Logger/Options/LoggerOptionBuilder.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Options/LoggerOptionBuilder.cs rename to src/CSharp/EasyMicroservices.Logger/Options/LoggerOptionBuilder.cs diff --git a/src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Providers/BaseProvider.cs b/src/CSharp/EasyMicroservices.Logger/Providers/BaseProvider.cs similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/EasyMicroservices.Logger/Providers/BaseProvider.cs rename to src/CSharp/EasyMicroservices.Logger/Providers/BaseProvider.cs diff --git a/src/CSharp/EasyMicroservices.Logger/coverage-badge-branch.svg b/src/CSharp/coverage-badge-branch.svg similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/coverage-badge-branch.svg rename to src/CSharp/coverage-badge-branch.svg diff --git a/src/CSharp/EasyMicroservices.Logger/coverage-badge-line.svg b/src/CSharp/coverage-badge-line.svg similarity index 100% rename from src/CSharp/EasyMicroservices.Logger/coverage-badge-line.svg rename to src/CSharp/coverage-badge-line.svg