< Summary

Information
Class: NexusLabs.Needlr.Extensions.Logging.PostBuildServiceCollectionPluginOptionsExtensions
Assembly: NexusLabs.Needlr.Extensions.Logging
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Extensions.Logging/PostBuildServiceCollectionPluginOptionsExtensions.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 22
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Extensions.Logging/PostBuildServiceCollectionPluginOptionsExtensions.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2using Microsoft.Extensions.Logging;
 3
 4namespace NexusLabs.Needlr.Extensions.Logging;
 5
 6/// <summary>
 7/// Extension methods for <see cref="PostBuildServiceCollectionPluginOptions"/> to simplify logger retrieval.
 8/// </summary>
 9public static class PostBuildServiceCollectionPluginOptionsExtensions
 10{
 11    public static ILogger GetLogger<T>(this PostBuildServiceCollectionPluginOptions options)
 12    {
 213        ArgumentNullException.ThrowIfNull(options);
 114        return options.Provider.GetRequiredService<ILogger<T>>();
 15    }
 16
 17    public static ILogger GetLogger(this PostBuildServiceCollectionPluginOptions options)
 18    {
 219        ArgumentNullException.ThrowIfNull(options);
 120        return options.Provider.GetRequiredService<ILogger>();
 21    }
 22}