Skip to content

Commit 9dcb6a0

Browse files
alexrpRehanSaeed
authored andcommitted
LoggerFactoryExtensions -> LoggingBuilderExtensions.
1 parent 44a8adc commit 9dcb6a0

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ Provides ASP.NET Core middleware, MVC filters, extension methods and helper code
9696

9797
- [ASP.NET Core Fluent Interface Extensions](https://rehansaeed.com/asp-net-core-fluent-interface-extensions/)
9898

99-
**ILoggerFactory Extensions**
99+
**ILoggingBuilder Extensions**
100100

101101
```c#
102-
loggerfactory
102+
loggingBuilder
103103
.AddIfElse(
104104
hostingEnvironment.IsDevelopment(),
105105
x => x.AddConsole(...).AddDebug(),

Source/Boxed.AspNetCore/LoggerFactoryExtensions.cs renamed to Source/Boxed.AspNetCore/LoggingBuilderExtensions.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ namespace Boxed.AspNetCore
44
using Microsoft.Extensions.Logging;
55

66
/// <summary>
7-
/// <see cref="ILoggerFactory"/> extension methods.
7+
/// <see cref="ILoggingBuilder"/> extension methods.
88
/// </summary>
9-
public static class LoggerFactoryExtensions
9+
public static class LoggingBuilderExtensions
1010
{
1111
/// <summary>
1212
/// Executes the specified action if the specified <paramref name="condition"/> is <c>true</c> which can be
13-
/// used to conditionally add to the logger factory.
13+
/// used to conditionally add to the logging builder.
1414
/// </summary>
15-
/// <param name="loggerFactory">The logger factory.</param>
15+
/// <param name="loggingBuilder">The logging builder.</param>
1616
/// <param name="condition">If set to <c>true</c> the action is executed.</param>
17-
/// <param name="action">The action used to add to the logger factory.</param>
18-
/// <returns>The same logger factory.</returns>
19-
public static ILoggerFactory AddIf(
20-
this ILoggerFactory loggerFactory,
17+
/// <param name="action">The action used to add to the logging builder.</param>
18+
/// <returns>The same logging builder.</returns>
19+
public static ILoggingBuilder AddIf(
20+
this ILoggingBuilder loggingBuilder,
2121
bool condition,
22-
Func<ILoggerFactory, ILoggerFactory> action)
22+
Func<ILoggingBuilder, ILoggingBuilder> action)
2323
{
24-
if (loggerFactory is null)
24+
if (loggingBuilder is null)
2525
{
26-
throw new ArgumentNullException(nameof(loggerFactory));
26+
throw new ArgumentNullException(nameof(loggingBuilder));
2727
}
2828

2929
if (action is null)
@@ -33,32 +33,32 @@ public static ILoggerFactory AddIf(
3333

3434
if (condition)
3535
{
36-
loggerFactory = action(loggerFactory);
36+
loggingBuilder = action(loggingBuilder);
3737
}
3838

39-
return loggerFactory;
39+
return loggingBuilder;
4040
}
4141

4242
/// <summary>
4343
/// Executes the specified <paramref name="ifAction"/> if the specified <paramref name="condition"/> is
4444
/// <c>true</c>, otherwise executes the <paramref name="elseAction"/>. This can be used to conditionally add to
45-
/// the logger factory.
45+
/// the logging builder.
4646
/// </summary>
47-
/// <param name="loggerFactory">The logger factory.</param>
47+
/// <param name="loggingBuilder">The logging builder.</param>
4848
/// <param name="condition">If set to <c>true</c> the <paramref name="ifAction"/> is executed, otherwise the
4949
/// <paramref name="elseAction"/> is executed.</param>
50-
/// <param name="ifAction">The action used to add to the logger factory if the condition is <c>true</c>.</param>
51-
/// <param name="elseAction">The action used to add to the logger factory if the condition is <c>false</c>.</param>
52-
/// <returns>The same logger factory.</returns>
53-
public static ILoggerFactory AddIfElse(
54-
this ILoggerFactory loggerFactory,
50+
/// <param name="ifAction">The action used to add to the logging builder if the condition is <c>true</c>.</param>
51+
/// <param name="elseAction">The action used to add to the logging builder if the condition is <c>false</c>.</param>
52+
/// <returns>The same logging builder.</returns>
53+
public static ILoggingBuilder AddIfElse(
54+
this ILoggingBuilder loggingBuilder,
5555
bool condition,
56-
Func<ILoggerFactory, ILoggerFactory> ifAction,
57-
Func<ILoggerFactory, ILoggerFactory> elseAction)
56+
Func<ILoggingBuilder, ILoggingBuilder> ifAction,
57+
Func<ILoggingBuilder, ILoggingBuilder> elseAction)
5858
{
59-
if (loggerFactory is null)
59+
if (loggingBuilder is null)
6060
{
61-
throw new ArgumentNullException(nameof(loggerFactory));
61+
throw new ArgumentNullException(nameof(loggingBuilder));
6262
}
6363

6464
if (ifAction is null)
@@ -73,14 +73,14 @@ public static ILoggerFactory AddIfElse(
7373

7474
if (condition)
7575
{
76-
loggerFactory = ifAction(loggerFactory);
76+
loggingBuilder = ifAction(loggingBuilder);
7777
}
7878
else
7979
{
80-
loggerFactory = elseAction(loggerFactory);
80+
loggingBuilder = elseAction(loggingBuilder);
8181
}
8282

83-
return loggerFactory;
83+
return loggingBuilder;
8484
}
8585
}
8686
}

0 commit comments

Comments
 (0)