Skip to content

Commit b48ef23

Browse files
committed
VersionBump : v0.41.0
1 parent f4eb8a2 commit b48ef23

File tree

10 files changed

+118
-9
lines changed

10 files changed

+118
-9
lines changed

src/CodeOfChaos.Extensions.Analyzers/CodeOfChaos.Extensions.Analyzers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<!-- Main package name -->
1414
<PackageId>CodeOfChaos.Extensions.Analyzers</PackageId>
15-
<Version>0.40.1</Version>
15+
<Version>0.41.0</Version>
1616
<Authors>Anna Sas</Authors>
1717
<Description>Additional diagnostics to make CodeOfChaos.Extensions easier to use as a developer</Description>
1818
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-extensions</PackageProjectUrl>

src/CodeOfChaos.Extensions.AspNetCore/CodeOfChaos.Extensions.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<!-- Main package name -->
1010
<PackageId>CodeOfChaos.Extensions.AspNetCore</PackageId>
11-
<Version>0.40.1</Version>
11+
<Version>0.41.0</Version>
1212
<Authors>Anna Sas</Authors>
1313
<Description>A Library of broadly used extensions for AspNetCore</Description>
1414
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-extensions</PackageProjectUrl>

src/CodeOfChaos.Extensions.DependencyInjection.Generators/CodeOfChaos.Extensions.DependencyInjection.Generators.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<IsPackable>true</IsPackable>
1414
<PackageId>CodeOfChaos.Extensions.DependencyInjection.Generators</PackageId> <!-- Main package name -->
15-
<Version>0.40.1</Version> <!-- Package version -->
15+
<Version>0.41.0</Version> <!-- Package version -->
1616
<Authors>Anna Sas</Authors>
1717
<Description>A small package allowing easy collection of dependency injection services</Description>
1818
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-extensions</PackageProjectUrl>

src/CodeOfChaos.Extensions.DependencyInjection/CodeOfChaos.Extensions.DependencyInjection.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<IsPackable>true</IsPackable>
99
<PackageId>CodeOfChaos.Extensions.DependencyInjection</PackageId> <!-- Main package name -->
10-
<Version>0.40.1</Version> <!-- Package version -->
10+
<Version>0.41.0</Version> <!-- Package version -->
1111
<Authors>Anna Sas</Authors>
1212
<Description>A small package allowing easy collection of dependency injection services</Description>
1313
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-extensions</PackageProjectUrl>

src/CodeOfChaos.Extensions.EntityFrameworkCore/CodeOfChaos.Extensions.EntityFrameworkCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<!-- Main package name -->
1010
<PackageId>CodeOfChaos.Extensions.EntityFrameworkCore</PackageId>
11-
<Version>0.40.1</Version>
11+
<Version>0.41.0</Version>
1212
<Authors>Anna Sas</Authors>
1313
<Description>A Library of broadly used extensions for EntityFrameworkCore</Description>
1414
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-extensions</PackageProjectUrl>

src/CodeOfChaos.Extensions.FluentValidation/CodeOfChaos.Extensions.FluentValidation.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<!-- Main package name -->
99
<PackageId>CodeOfChaos.Extensions.FluentValidation</PackageId>
10-
<Version>0.40.1</Version>
10+
<Version>0.41.0</Version>
1111
<Authors>Anna Sas</Authors>
1212
<Description>A Library of extensions for FluentValidation</Description>
1313
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-extensions</PackageProjectUrl>

src/CodeOfChaos.Extensions.MicrosoftLogging/CodeOfChaos.Extensions.MicrosoftLogging.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<!-- Main package name -->
99
<PackageId>CodeOfChaos.Extensions.MicrosoftLogging</PackageId>
10-
<Version>0.40.1</Version>
10+
<Version>0.41.0</Version>
1111
<Authors>Anna Sas</Authors>
1212
<Description>A simple extension library for Microsoft's logging</Description>
1313
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-extensions</PackageProjectUrl>

src/CodeOfChaos.Extensions.MicrosoftLogging/LoggerExtensions.cs

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,115 @@ namespace Microsoft.Extensions.Logging;
1111
// ---------------------------------------------------------------------------------------------------------------------
1212
public static class LoggerExtensions {
1313

14+
#region AsFalse
15+
/// <summary>
16+
/// Logs an informational message and returns false.
17+
/// </summary>
18+
/// <param name="logger">The logger instance.</param>
19+
/// <param name="messageTemplate">The message template to log.</param>
20+
/// <param name="propertyValues">The property values for the message template.</param>
21+
/// <returns>Always returns false.</returns>
22+
[StringFormatMethod("messageTemplate")]
23+
public static bool InformationAsFalse(this ILogger logger, string messageTemplate, params object?[] propertyValues) {
24+
logger.Information(messageTemplate, propertyValues);
25+
return false;
26+
}
27+
28+
/// <summary>
29+
/// Logs a debug-level message and always returns false.
30+
/// </summary>
31+
/// <param name="logger">The logger instance used to log the message.</param>
32+
/// <param name="messageTemplate">The message template that describes the log message.</param>
33+
/// <param name="propertyValues">Optional property values for formatting the message template.</param>
34+
/// <returns>Always returns false.</returns>
35+
[StringFormatMethod("messageTemplate")]
36+
public static bool DebugAsFalse(this ILogger logger, string messageTemplate, params object?[] propertyValues) {
37+
logger.Debug(messageTemplate, propertyValues);
38+
return false;
39+
}
40+
41+
/// <summary>
42+
/// Logs a warning message and always returns false.
43+
/// </summary>
44+
/// <param name="logger">The logger instance.</param>
45+
/// <param name="messageTemplate">The message template to log.</param>
46+
/// <param name="propertyValues">Values to format into the template.</param>
47+
/// <returns>Always returns false.</returns>
48+
[StringFormatMethod("messageTemplate")]
49+
public static bool WarningAsFalse(this ILogger logger, string messageTemplate, params object?[] propertyValues) {
50+
logger.Warning(messageTemplate, propertyValues);
51+
return false;
52+
}
53+
54+
/// <summary>
55+
/// Logs an error message with the specified message template and property values,
56+
/// then always returns false.
57+
/// </summary>
58+
/// <param name="logger">The logger instance.</param>
59+
/// <param name="messageTemplate">The message template describing the log message format.</param>
60+
/// <param name="propertyValues">An array of objects to format into the message template.</param>
61+
/// <returns>Always returns false.</returns>
62+
[StringFormatMethod("messageTemplate")]
63+
public static bool ErrorAsFalse(this ILogger logger, string messageTemplate, params object?[] propertyValues) {
64+
logger.Error(messageTemplate, propertyValues);
65+
return false;
66+
}
67+
68+
#endregion
69+
#region AsTrue
70+
/// <summary>
71+
/// Logs a debug-level message and returns true.
72+
/// </summary>
73+
/// <param name="logger">The logger instance.</param>
74+
/// <param name="messageTemplate">The message template for the log entry.</param>
75+
/// <param name="propertyValues">The property values corresponding to the message template.</param>
76+
/// <returns>Always returns true.</returns>
77+
[StringFormatMethod("messageTemplate")]
78+
public static bool DebugAsTrue(this ILogger logger, string messageTemplate, params object?[] propertyValues) {
79+
logger.LogDebug(messageTemplate, propertyValues);
80+
return true;
81+
}
82+
83+
/// <summary>
84+
/// Logs an information-level message and returns true.
85+
/// </summary>
86+
/// <param name="logger">The logger instance.</param>
87+
/// <param name="messageTemplate">The message template to log.</param>
88+
/// <param name="propertyValues">An array of property values to format and include in the message.</param>
89+
/// <returns>Returns true after logging the message.</returns>
90+
[StringFormatMethod("messageTemplate")]
91+
public static bool InformationAsTrue(this ILogger logger, string messageTemplate, params object?[] propertyValues) {
92+
logger.LogInformation(messageTemplate, propertyValues);
93+
return true;
94+
}
95+
96+
/// <summary>
97+
/// Logs a warning level message and returns true.
98+
/// </summary>
99+
/// <param name="logger">The logger instance used for logging.</param>
100+
/// <param name="messageTemplate">The message template describing the log event.</param>
101+
/// <param name="propertyValues">The values to format the message template.</param>
102+
/// <returns>Always returns true.</returns>
103+
[StringFormatMethod("messageTemplate")]
104+
public static bool WarningAsTrue(this ILogger logger, string messageTemplate, params object?[] propertyValues) {
105+
logger.LogWarning(messageTemplate, propertyValues);
106+
return true;
107+
}
108+
109+
/// <summary>
110+
/// Logs an error message at the Error level and returns a boolean value of true.
111+
/// </summary>
112+
/// <param name="logger">The logger instance.</param>
113+
/// <param name="messageTemplate">The message template to be logged.</param>
114+
/// <param name="propertyValues">The property values for the message template.</param>
115+
/// <returns>True, indicating that the operation was successful.</returns>
116+
[StringFormatMethod("messageTemplate")]
117+
public static bool ErrorAsTrue(this ILogger logger, string messageTemplate, params object?[] propertyValues) {
118+
logger.LogError(messageTemplate, propertyValues);
119+
return true;
120+
}
121+
#endregion
122+
14123
[StringFormatMethod("message")]
15124
public static void Debug(this ILogger logger, EventId eventId, Exception? exception, string? message, params object?[] args)
16125
=> logger.LogDebug(eventId, exception, message, args);

src/CodeOfChaos.Extensions.Serilog/CodeOfChaos.Extensions.Serilog.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<!-- Main package name -->
99
<PackageId>CodeOfChaos.Extensions.Serilog</PackageId>
10-
<Version>0.40.1</Version>
10+
<Version>0.41.0</Version>
1111
<Authors>Anna Sas</Authors>
1212
<Description>A Library of broadly used extensions for Serilog</Description>
1313
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-extensions</PackageProjectUrl>

src/CodeOfChaos.Extensions/CodeOfChaos.Extensions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<!-- Main package name -->
1010
<PackageId>CodeOfChaos.Extensions</PackageId>
11-
<Version>0.40.1</Version>
11+
<Version>0.41.0</Version>
1212
<Authors>Anna Sas</Authors>
1313
<Description>A Library of broadly used extensions for dotnet in general</Description>
1414
<PackageProjectUrl>https://github.com/code-of-chaos/cs-code_of_chaos-extensions</PackageProjectUrl>

0 commit comments

Comments
 (0)