-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b94b4a9
commit 2153f63
Showing
28 changed files
with
71 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<Version>0.0.0.2</Version> | ||
<Version>0.0.0.3</Version> | ||
<Description>logger wrapper</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>log,logger,logging,log4net</PackageTags> | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<Version>0.0.0.1</Version> | ||
<Version>0.0.0.3</Version> | ||
<Description>logger wrapper</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>log,logger,logging</PackageTags> | ||
|
64 changes: 64 additions & 0 deletions
64
src/CSharp/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using EasyMicroservices.Logger.Options; | ||
using System; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public static class LoggerExtensions | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="services"></param> | ||
/// <param name="options"></param> | ||
/// <returns></returns> | ||
public static IServiceCollection AddLogger(this IServiceCollection services, Action<LoggerOption> options) | ||
{ | ||
return AddLoggerTransient(services, options); | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="services"></param> | ||
/// <param name="options"></param> | ||
/// <returns></returns> | ||
public static IServiceCollection AddLoggerScoped(this IServiceCollection services, Action<LoggerOption> options) | ||
{ | ||
options.ThrowIfNull(nameof(options)); | ||
options(new LoggerOption()); | ||
services.AddScoped(service => LoggerOptionBuilder.GetLogger()); | ||
return services; | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="services"></param> | ||
/// <param name="options"></param> | ||
/// <returns></returns> | ||
public static IServiceCollection AddLoggerTransient(this IServiceCollection services, Action<LoggerOption> options) | ||
{ | ||
options.ThrowIfNull(nameof(options)); | ||
options(new LoggerOption()); | ||
services.AddTransient(service => LoggerOptionBuilder.GetLogger()); | ||
return services; | ||
} | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="services"></param> | ||
/// <param name="options"></param> | ||
/// <returns></returns> | ||
public static IServiceCollection AddLoggerSingleton(this IServiceCollection services, Action<LoggerOption> options) | ||
{ | ||
options.ThrowIfNull(nameof(options)); | ||
options(new LoggerOption()); | ||
services.AddSingleton(service => LoggerOptionBuilder.GetLogger()); | ||
return services; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<Version>0.0.0.2</Version> | ||
<Version>0.0.0.3</Version> | ||
<Description>logger wrapper</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>log,logger,logging,nlog</PackageTags> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<Version>0.0.0.2</Version> | ||
<Version>0.0.0.3</Version> | ||
<Description>logger wrapper</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>log,logger,logging,serilog</PackageTags> | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 0 additions & 26 deletions
26
...EasyMicroservices.Logger/EasyMicroservices.Logger.DependencyInjection/LoggerExtensions.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks> | ||
<Authors>EasyMicroservices</Authors> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<Version>0.0.0.2</Version> | ||
<Version>0.0.0.3</Version> | ||
<Description>Logger and Auditing system</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>logging,auditing</PackageTags> | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes