Skip to content

Commit

Permalink
Merge pull request #45 from einari/main
Browse files Browse the repository at this point in the history
Fixing log messages
  • Loading branch information
Kritner authored Oct 6, 2023
2 parents c19842b + 92a979a commit d9ffbaf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Orleans.SyncWork/SyncWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public Task<bool> Start(TRequest request)
{
if (_task != null)
{
_logger.LogDebug("{nameof(Start)}: Task already initialized upon call.", nameof(Start));
_logger.LogDebug("{Method}: Task already initialized upon call.", nameof(Start));
return Task.FromResult(false);
}

_logger.LogDebug("{nameof(Start)}: Starting task, set status to running.", nameof(Start));
_logger.LogDebug("{Method}: Starting task, set status to running.", nameof(Start));
_status = SyncWorkStatus.Running;
_task = CreateTask(request);

Expand All @@ -60,7 +60,7 @@ public Task<SyncWorkStatus> GetWorkStatus()
{
if (_status == SyncWorkStatus.NotStarted)
{
_logger.LogError("{nameof(GetWorkStatus} was in a status of {SyncWorkStatus.NotStarted}", nameof(GetWorkStatus), SyncWorkStatus.NotStarted);
_logger.LogError("{Method} was in a status of {WorkStatus}", nameof(GetWorkStatus), SyncWorkStatus.NotStarted);
DeactivateOnIdle();
throw new InvalidStateException(_status);
}
Expand All @@ -73,7 +73,7 @@ public Task<Exception> GetException()
{
if (_status != SyncWorkStatus.Faulted)
{
_logger.LogError("{nameof(GetException)}: Attempting to retrieve exception from grain when grain not in a faulted state ({_status}).", nameof(GetException), _status);
_logger.LogError("{Method}: Attempting to retrieve exception from grain when grain not in a faulted state ({_status}).", nameof(GetException), _status);
DeactivateOnIdle();
throw new InvalidStateException(_status, SyncWorkStatus.Faulted);
}
Expand All @@ -89,7 +89,7 @@ public Task<TResult> GetResult()
{
if (_status != SyncWorkStatus.Completed)
{
_logger.LogError("{nameof(GetResult)}: Attempting to retrieve result from grain when grain not in a completed state ({_status}).", nameof(GetResult), _status);
_logger.LogError("{Method}: Attempting to retrieve result from grain when grain not in a completed state ({Status}).", nameof(GetResult), _status);
DeactivateOnIdle();
throw new InvalidStateException(_status, SyncWorkStatus.Completed);
}
Expand Down Expand Up @@ -118,15 +118,15 @@ private Task CreateTask(TRequest request)
{
try
{
_logger.LogInformation("{nameof(CreateTask)}: Beginning work for task.", nameof(CreateTask));
_logger.LogInformation("{Method}: Beginning work for task.", nameof(CreateTask));
_result = await PerformWork(request);
_exception = default;
_status = SyncWorkStatus.Completed;
_logger.LogInformation("{nameof(CreateTask)}: Completed work for task.", nameof(CreateTask));
_logger.LogInformation("{Method}: Completed work for task.", nameof(CreateTask));
}
catch (Exception e)
{
_logger.LogError(e, "{nameof(CreateTask)}: Exception during task.", nameof(CreateTask));
_logger.LogError(e, "{Method)}: Exception during task.", nameof(CreateTask));
_result = default;
_exception = e;
_status = SyncWorkStatus.Faulted;
Expand Down

0 comments on commit d9ffbaf

Please sign in to comment.