diff --git a/test/Worker/Migrations/M1.cs b/test/Worker/Migrations/M1.cs
index bb7ddac..dd6074a 100644
--- a/test/Worker/Migrations/M1.cs
+++ b/test/Worker/Migrations/M1.cs
@@ -11,14 +11,16 @@ namespace InfinityFlow.Temporal.Migrator.Worker.Migrations;
/// M1.
///
[Migration(1)]
-public class M1 : IMigration
+public partial class M1 : IMigration
{
+ private readonly ILogger _logger = Workflow.Logger;
+
///
public ValueTask ExecuteAsync(CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
- Workflow.Logger.LogInformation("In M1 - {InWorkflow}", Workflow.InWorkflow);
+ LogM1(Workflow.InWorkflow);
if (!Workflow.InWorkflow)
{
throw new InvalidOperationException("Not in workflow");
@@ -26,4 +28,11 @@ public ValueTask ExecuteAsync(CancellationToken cancellationToken)
return ValueTask.CompletedTask;
}
+
+ [LoggerMessage(
+ EventId = 0,
+ EventName = "M1",
+ Level = LogLevel.Information,
+ Message = "In M1 - {inWorkflow}")]
+ private partial void LogM1(bool inWorkflow);
}
diff --git a/test/Worker/Migrations/M2.cs b/test/Worker/Migrations/M2.cs
index fc19f28..56bb8a0 100644
--- a/test/Worker/Migrations/M2.cs
+++ b/test/Worker/Migrations/M2.cs
@@ -11,12 +11,21 @@ namespace InfinityFlow.Temporal.Migrator.Worker.Migrations;
/// M2.
///
[Migration(2)]
-public class M2 : IMigration
+public partial class M2 : IMigration
{
+ private readonly ILogger _logger = Workflow.Logger;
+
///
public ValueTask ExecuteAsync(CancellationToken cancellationToken)
{
- Workflow.Logger.LogInformation("In M2");
+ LogM2();
return ValueTask.CompletedTask;
}
+
+ [LoggerMessage(
+ EventId = 0,
+ EventName = "M2",
+ Level = LogLevel.Information,
+ Message = "In M2")]
+ private partial void LogM2();
}