Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit fe3ddbd

Browse files
refactor: remove time from log statements
1 parent d38495b commit fe3ddbd

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/ServiceLayer.Mesh/Functions/MeshHandshakeFunction.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ public class MeshHandshakeFunction(
1414
[Function("MeshHandshakeFunction")]
1515
public async Task Run([TimerTrigger("%MeshHandshakeTimerExpression%")] TimerInfo myTimer)
1616
{
17-
logger.LogInformation("{FunctionName} started at: {Time}", nameof(MeshHandshakeFunction), DateTime.UtcNow);
17+
logger.LogInformation("{FunctionName} started", nameof(MeshHandshakeFunction));
1818

1919
try
2020
{
2121
var response = await meshOperationService.MeshHandshakeAsync(configuration.NbssMeshMailboxId);
2222

2323
if (response.IsSuccessful)
2424
{
25-
logger.LogInformation("Mesh handshake completed successfully for mailbox {MailboxId} at {Time}. Status: {Status}",
26-
response.Response.MailboxId, DateTime.UtcNow, response.IsSuccessful);
25+
logger.LogInformation("Mesh handshake completed successfully for mailbox {MailboxId}. Status: {Status}",
26+
response.Response.MailboxId, response.IsSuccessful);
2727
}
2828
else
2929
{
30-
logger.LogWarning("Mesh handshake failed for mailbox {MailboxId} at {Time}. Error: {Error}",
31-
configuration.NbssMeshMailboxId, DateTime.UtcNow, response.Error);
30+
logger.LogWarning("Mesh handshake failed for mailbox {MailboxId}. Error: {Error}",
31+
configuration.NbssMeshMailboxId, response.Error);
3232
}
3333
}
3434
catch (Exception ex)
3535
{
36-
logger.LogError(ex, "An error occurred during mesh handshake for mailbox {MailboxId} at {Time}", configuration.NbssMeshMailboxId, DateTime.UtcNow);
36+
logger.LogError(ex, "An error occurred during mesh handshake for mailbox {MailboxId}.", configuration.NbssMeshMailboxId);
3737
}
3838
}
3939
}

tests/ServiceLayer.Mesh.Tests/Functions/MeshHandshakeFunctionTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task Run_SuccessfulHandshake_LogsSuccessAndCompletion()
5050

5151
// Assert
5252
_meshOperationServiceMock.Verify(s => s.MeshHandshakeAsync(TestMailboxId), Times.Once());
53-
VerifyLogMessage(LogLevel.Information, "MeshHandshakeFunction started at");
53+
VerifyLogMessage(LogLevel.Information, "MeshHandshakeFunction started");
5454
VerifyLogMessage(LogLevel.Information, "Mesh handshake completed successfully for mailbox");
5555
}
5656

@@ -75,7 +75,7 @@ public async Task Run_FailedHandshake_LogsWarningAndCompletion()
7575

7676
// Assert
7777
_meshOperationServiceMock.Verify(s => s.MeshHandshakeAsync(TestMailboxId), Times.Once());
78-
VerifyLogMessage(LogLevel.Information, "MeshHandshakeFunction started at");
78+
VerifyLogMessage(LogLevel.Information, "MeshHandshakeFunction started");
7979
VerifyLogMessage(LogLevel.Warning, "Mesh handshake failed");
8080
}
8181

@@ -93,7 +93,7 @@ public async Task Run_ExceptionThrown_LogsErrorAndCompletion()
9393

9494
// Assert
9595
_meshOperationServiceMock.Verify(s => s.MeshHandshakeAsync(TestMailboxId), Times.Once());
96-
VerifyLogMessage(LogLevel.Information, "MeshHandshakeFunction started at");
96+
VerifyLogMessage(LogLevel.Information, "MeshHandshakeFunction started");
9797
VerifyLogMessage(LogLevel.Error, "An error occurred during mesh handshake");
9898
_loggerMock.Verify(
9999
x => x.Log(

0 commit comments

Comments
 (0)