Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use params for log messages #897

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public override async Task UpdateStatusAsync(string timerName, ScheduleStatus st
catch (Exception ex)
{
// best effort
_logger.LogError(ex, $"Function '{timerName}' failed to update the timer trigger status.");
_logger.LogError(ex, "Function '{timerName}' failed to update the timer trigger status.", timerName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ private void ProcessFiles()

if (filesToProcess.Length > 0)
{
_logger.LogDebug($"Found {filesToProcess.Length} file(s) at path '{_watchPath}' for ready processing");
_logger.LogDebug("Found {fileCount} file(s) at path '{watchPath}' for ready processing",
filesToProcess.Length, _watchPath);
}

foreach (string fileToProcess in filesToProcess)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ public virtual void CleanupProcessedFiles()

if (filesDeleted > 0)
{
_logger.LogDebug($"File Cleanup ({_filePath}): {filesDeleted} files deleted");
_logger.LogDebug("File Cleanup ({filePath}): {filesDeleted} files deleted",
_filePath, filesDeleted);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
StartTimer(DateTime.Now);
}

_logger.LogDebug($"Timer listener started ({_functionLogName})");
_logger.LogDebug("Timer listener started ({functionName})", _functionLogName);
}

public async Task StopAsync(CancellationToken cancellationToken)
Expand All @@ -169,7 +169,7 @@ public async Task StopAsync(CancellationToken cancellationToken)
await _invocationLock.WaitAsync();
_invocationLock.Release();

_logger.LogDebug($"Timer listener stopped ({_functionLogName})");
_logger.LogDebug("Timer listener stopped ({functionName})", _functionLogName);
}

public void Cancel()
Expand Down Expand Up @@ -342,7 +342,8 @@ internal async Task InvokeJobFunction(DateTime invocationTime, bool isPastDue =
if (ScheduleMonitor != null)
{
await ScheduleMonitor.UpdateStatusAsync(_timerLookupName, ScheduleStatus);
_logger.LogDebug($"Function '{_functionLogName}' updated status: Last='{ScheduleStatus.Last.ToString("o")}', Next='{ScheduleStatus.Next.ToString("o")}', LastUpdated='{ScheduleStatus.LastUpdated.ToString("o")}'");
_logger.LogDebug("Function '{functionName}' updated status: Last='{lastScheduled}\', Next=\'{nextScheduled}\', LastUpdated=\'{lastUpdated}\'",
_functionLogName, ScheduleStatus.Last.ToString("o"), ScheduleStatus.Next.ToString("o"), ScheduleStatus.LastUpdated.ToString("o"));
}
}
finally
Expand Down
Loading