Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension method for registering ILogger wrapper classes #54

Merged
merged 1 commit into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/SenseNet.Tools/Diagnostics/LoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,16 @@ public static IServiceProvider AddSenseNetILogger(this IServiceProvider provider

return provider;
}

/// <summary>
/// Register the logger and tracer wrapper classes for the ILogger interface.
/// </summary>
public static IServiceCollection AddSenseNetILogger(this IServiceCollection services)
{
services.AddSingleton<IEventLogger, SnILogger>();
services.AddSingleton<ISnTracer, SnILoggerTracer>();

return services;
}
}
}
2 changes: 1 addition & 1 deletion src/SenseNet.Tools/Diagnostics/SnILogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace SenseNet.Diagnostics
/// <summary>
/// Routes all log messages to the official .Net log interface.
/// </summary>
internal class SnILogger : SnEventloggerBase
public class SnILogger : SnEventloggerBase
{
private readonly ILogger<SnILogger> _logger;
public SnILogger(ILogger<SnILogger> logger)
Expand Down
2 changes: 1 addition & 1 deletion src/SenseNet.Tools/Diagnostics/SnILoggerTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace SenseNet.Diagnostics
/// <summary>
/// Routes all trace messages to the official .Net log interface.
/// </summary>
internal class SnILoggerTracer : ISnTracer
public class SnILoggerTracer : ISnTracer
{
private readonly ILogger<SnILoggerTracer> _logger;
public SnILoggerTracer(ILogger<SnILoggerTracer> logger)
Expand Down