Skip to content

Commit b12fb41

Browse files
committed
Separate the LoggerMessageDefinitionsApi.cs
1 parent 9342453 commit b12fb41

14 files changed

+182
-142
lines changed

src/AStar.Dev.Logging.Extensions/AStar.Dev.Logging.Extensions.csproj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,16 @@
1919
<PackageLicenseFile>LICENSE</PackageLicenseFile>
2020
<PackageProjectUrl>https://github.com/astar-development/astar-dev-logging-extensions</PackageProjectUrl>
2121
<PackageReadmeFile>README.md</PackageReadmeFile>
22-
<PackageReleaseNotes>Add more LoggerMessage.Define methods</PackageReleaseNotes>
22+
<PackageReleaseNotes>Add overloads to the API LoggerMessage.Define methods</PackageReleaseNotes>
2323
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
2424
<RepositoryType>git</RepositoryType>
2525
<RepositoryUrl>https://github.com/astar-development/astar-dev-logging-extensions.git</RepositoryUrl>
2626
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2727
<TargetFramework>net9.0</TargetFramework>
2828
<Title>AStar.Dev.Logging.Extensions</Title>
29-
<Version>0.5.3</Version>
29+
<Version>0.5.4</Version>
3030
</PropertyGroup>
3131

32-
3332
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
3433
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
3534
</PropertyGroup>
@@ -69,5 +68,3 @@
6968
</ItemGroup>
7069

7170
</Project>
72-
73-

src/AStar.Dev.Logging.Extensions/AStar.Dev.Logging.Extensions.xml

Lines changed: 37 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AStar.Dev.Logging.Extensions/AStarLoggerApi.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using AStar.Dev.Api.HealthChecks;
2-
using AStar.Dev.Functional.Extensions;
3-
41
namespace AStar.Dev.Logging.Extensions;
52

63
public partial class AStarLogger<TCategoryName>

src/AStar.Dev.Logging.Extensions/AStarLoggerCommon.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
namespace AStar.Dev.Logging.Extensions;
55

66
/// <summary>
7-
/// The <see cref="AStarLogger{TCategoryName}"/> class supplies the currently supported, predefined, Log Messages.
8-
/// There is an additional <seealso cref="Log{TState}"/> method for any currently not implemented log message
7+
/// The <see cref="AStarLogger{TCategoryName}" /> class supplies the currently supported, predefined, Log Messages.
8+
/// There is an additional <seealso cref="Log{TState}" /> method for any currently not implemented log message
99
/// </summary>
10-
/// <param name="logger">The underlying instance of <see cref="ILogger{TCategoryName}"/> that will perform the actual logging</param>
11-
/// <param name="telemetryClient">An instance of the <see cref="IAStarTelemetryClient"/> to perform the Application Insights-specific logging (e.g.: Page View)</param>
10+
/// <param name="logger">The underlying instance of <see cref="ILogger{TCategoryName}" /> that will perform the actual logging</param>
11+
/// <param name="telemetryClient">An instance of the <see cref="IAStarTelemetryClient" /> to perform the Application Insights-specific logging (e.g.: Page View)</param>
1212
/// <typeparam name="TCategoryName">The Logging type</typeparam>
1313
public partial class AStarLogger<TCategoryName>(ILogger<TCategoryName> logger, IAStarTelemetryClient telemetryClient) : ILoggerAstar<TCategoryName>
1414
{
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
using AStar.Dev.Api.HealthChecks;
2-
using AStar.Dev.Functional.Extensions;
3-
41
namespace AStar.Dev.Logging.Extensions;
52

63
public partial class AStarLogger<TCategoryName>
74
{
85
/// <inheritdoc />
96
public void LogHealthCheckStart(string apiName)
10-
=> LoggerMessageDefinitionsApi.HealthCheckStart(logger, apiName, null);
7+
=> LoggerMessageDefinitionsHealthChecks.HealthCheckStart(logger, apiName, null);
118

129
/// <inheritdoc />
1310
public void LogHealthCheckSuccess(string apiName)
14-
=> LoggerMessageDefinitionsApi.HealthCheckSuccess(logger, apiName, null);
11+
=> LoggerMessageDefinitionsHealthChecks.HealthCheckSuccess(logger, apiName, null);
1512

1613
/// <inheritdoc />
1714
public void LogHealthCheckWarning(string apiName, string warningMessage)
18-
=> LoggerMessageDefinitionsApi.HealthCheckWarning(logger, apiName, warningMessage, null);
15+
=> LoggerMessageDefinitionsHealthChecks.HealthCheckWarning(logger, apiName, warningMessage, null);
1916

2017
/// <inheritdoc />
2118
public void LogHealthCheckFailure(string apiName, string failureMessage)
22-
=> LoggerMessageDefinitionsApi.HealthCheckFailure(logger, apiName, failureMessage, null);
19+
=> LoggerMessageDefinitionsHealthChecks.HealthCheckFailure(logger, apiName, failureMessage, null);
2320
}

src/AStar.Dev.Logging.Extensions/AStarLoggerUi.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using AStar.Dev.Api.HealthChecks;
2-
using AStar.Dev.Functional.Extensions;
3-
41
namespace AStar.Dev.Logging.Extensions;
52

63
public partial class AStarLogger<TCategoryName>

src/AStar.Dev.Logging.Extensions/ILoggerAstar.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ public interface ILoggerAstar<out T> : ILogger<T>
8484
void LogApiCallFailed(string apiName, string uri, string failureMessage);
8585

8686
/// <summary>
87-
/// The ReturnLoggedFailure will log the Health Check failure and return the <see cref="HealthStatusResponse"/> object
87+
/// The ReturnLoggedFailure will log the Health Check failure and return the <see cref="HealthStatusResponse" /> object
8888
/// </summary>
89-
/// <param name="response">The instance of <see cref="HttpResponseMessage"/> from the original call</param>
89+
/// <param name="response">The instance of <see cref="HttpResponseMessage" /> from the original call</param>
9090
/// <param name="apiName">The name of the API being called</param>
91-
/// <returns>An instance of <see cref="HealthStatusResponse"/> appropriately configured</returns>
91+
/// <returns>An instance of <see cref="HealthStatusResponse" /> appropriately configured</returns>
9292
HealthStatusResponse ReturnLoggedFailure(HttpResponseMessage response, string apiName);
9393

9494
/// <summary>
95-
/// The ReturnLoggedSuccess method will log the successful call and return the TResult response object
95+
/// The ReturnLoggedSuccess method will log the successful call and return the TResult response object
9696
/// </summary>
9797
/// <param name="result"></param>
9898
/// <param name="apiName">The name of the API being called</param>
@@ -102,7 +102,7 @@ public interface ILoggerAstar<out T> : ILogger<T>
102102
TResult ReturnLoggedSuccess<TResult>(TResult result, string apiName, string endpointName);
103103

104104
/// <summary>
105-
/// The ReturnLoggedFailure method will log the failed call and return the TResult response object
105+
/// The ReturnLoggedFailure method will log the failed call and return the TResult response object
106106
/// </summary>
107107
/// <param name="apiName">The name of the API being called</param>
108108
/// <param name="endpointName">The endpoint name of the call</param>

src/AStar.Dev.Logging.Extensions/LoggerMessageDefinitionsApi.cs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,6 @@ namespace AStar.Dev.Logging.Extensions;
44
/// </summary>
55
public static class LoggerMessageDefinitionsApi
66
{
7-
/// <summary>
8-
/// Defines the HealthCheckFailure message definition
9-
/// </summary>
10-
public static Action<ILogger, string, string, Exception?> HealthCheckFailure => LoggerMessage.Define< string, string>(
11-
LogLevel.Warning,
12-
AStarEventIds.Api.HealthCheckFailure,
13-
"HealthCheck Failure: {ApiName} - {FailureMessage}");
14-
15-
/// <summary>
16-
/// Defines the HealthCheckStart message definition
17-
/// </summary>
18-
public static Action<ILogger, string, Exception?> HealthCheckStart => LoggerMessage.Define<string>(
19-
LogLevel.Debug,
20-
AStarEventIds.Api.HealthCheckStart,
21-
"HealthCheck Start: {ApiName}");
22-
23-
/// <summary>
24-
/// Defines the HealthCheckSuccess message definition
25-
/// </summary>
26-
public static Action<ILogger, string, Exception?> HealthCheckSuccess => LoggerMessage.Define<string>(
27-
LogLevel.Debug,
28-
AStarEventIds.Api.HealthCheckStart,
29-
"HealthCheck Success: {ApiName}");
30-
31-
/// <summary>
32-
/// Defines the HealthCheckWarning message definition
33-
/// </summary>
34-
public static Action<ILogger, string, string, Exception?> HealthCheckWarning => LoggerMessage.Define<string, string>(
35-
LogLevel.Warning,
36-
AStarEventIds.Api.HealthCheckWarning,
37-
"HealthCheck Warning: {ApiName} - {WarningMessage}");
38-
397
/// <summary>
408
/// Defines the ApiCallFailure message definition
419
/// </summary>

0 commit comments

Comments
 (0)