Skip to content

Commit 5da0a4d

Browse files
committed
Set serviceName in logs for not task-related logs
1 parent 3bcb002 commit 5da0a4d

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

EnoCore/EnoCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>
17-
<PackageReference Include="System.Text.Json" Version="5.0.0" />
17+
<PackageReference Include="System.Text.Json" Version="5.0.2" />
1818
</ItemGroup>
1919

2020
</Project>

EnoCore/Logging/EnoLogger.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ public class EnoLogger : ILogger
1414
private readonly string categoryName;
1515
private readonly IEnoLogMessageProvider provider;
1616
private readonly string tool;
17+
private readonly string? serviceName;
1718

18-
public EnoLogger(IEnoLogMessageProvider provider, string categoryName, string tool)
19+
public EnoLogger(IEnoLogMessageProvider provider, string categoryName, string tool, string? serviceName = null)
1920
{
2021
this.provider = provider;
2122
this.categoryName = categoryName;
2223
this.tool = tool;
24+
this.serviceName = serviceName;
2325
}
2426

2527
public static string GetSeverity(LogLevel logLevel)
@@ -150,7 +152,7 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
150152
message,
151153
null,
152154
null,
153-
null,
155+
this.serviceName,
154156
null);
155157
this.provider.Log($"##ENOLOGMESSAGE {JsonSerializer.Serialize(enoLogMessage, EnoCoreUtil.CamelCaseEnumConverterOptions)}\n");
156158
}

EnoCore/Scoreboard/Scoreboard.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using EnoCore.Models;
99

1010
public record Scoreboard(
11-
long? CurrentRound,
11+
long CurrentRound,
1212
string? StartTimestamp,
1313
double? StartTimeEpoch,
1414
string? EndTimestamp,

FlagShooter/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ public List<List<Task>> BeginSubmitFlags(long flagCount)
127127
try
128128
{
129129
long i = 0;
130-
if (sb != null && sb.CurrentRound != null && sb.CurrentRound > 0)
130+
if (sb != null && sb.CurrentRound > 0)
131131
{
132-
for (long r = sb.CurrentRound.Value; r > Math.Max(sb.CurrentRound.Value - this.configuration.FlagValidityInRounds, 0); r--)
132+
for (long r = sb.CurrentRound; r > Math.Max(sb.CurrentRound - this.configuration.FlagValidityInRounds, 0); r--)
133133
{
134134
for (int team = 0; team < this.configuration.Teams.Count; team++)
135135
{

0 commit comments

Comments
 (0)