< Summary

Information
Class: ArturRios.Logging.Adapter.MicrosoftLoggerBuilderExtensions
Assembly: ArturRios.Logging
File(s): D:\Repositories\dotnet-logging\src\Adapter\MicrosoftLoggerBuilderExtensions.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 25
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Fully covered methods: 0
Total methods: 1
Method coverage: 100%
Full method coverage: 0%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddCustomLogger(...)100%11100%

File(s)

D:\Repositories\dotnet-logging\src\Adapter\MicrosoftLoggerBuilderExtensions.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2using Microsoft.Extensions.Logging;
 3
 4namespace ArturRios.Logging.Adapter;
 5
 6/// <summary>
 7/// Extension methods for configuring the custom logger with Microsoft.Extensions.Logging.
 8/// </summary>
 9public static class MicrosoftLoggerBuilderExtensions
 10{
 11    /// <summary>
 12    /// Adds the custom logger provider to the logging builder.
 13    /// </summary>
 14    /// <param name="builder">The logging builder to configure.</param>
 15    /// <returns>The logging builder for method chaining.</returns>
 16    /// <exception cref="ArgumentNullException">Thrown when builder is null.</exception>
 17    public static ILoggingBuilder AddCustomLogger(this ILoggingBuilder builder)
 918    {
 919        ArgumentNullException.ThrowIfNull(builder);
 20
 821        builder.Services.AddSingleton<ILoggerProvider, MicrosoftLoggerProvider>();
 22
 823        return builder;
 824    }
 25}