refactor(archival): ♻ improve structured logging

This commit is contained in:
Collin M. Barrett 2020-09-14 09:45:54 -05:00
parent 94587ce572
commit d57a2a45c9

View file

@ -32,13 +32,13 @@ public async Task ArchiveFileAsync(
string filePath,
CancellationToken cancellationToken = default)
{
_logger.LogInformation("Archiving {filePath}", filePath);
_logger.LogDebug("Writing {filePath}", filePath);
_filePaths.Add(filePath);
await using var output = File.OpenWrite(filePath);
await fileContents.CopyToAsync(output, cancellationToken);
_logger.LogInformation("Archived {filePath}", filePath);
_logger.LogDebug("Finished writing {filePath}", filePath);
}
public void Commit()
@ -48,7 +48,7 @@ public void Commit()
var message = $"feat(archives): archive {_filePaths.Count} files{Environment.NewLine}{string.Join(Environment.NewLine, _filePaths)}";
_repository.Commit(message, signature, signature);
_logger.LogInformation("Committed {filePaths}", string.Join(",", _filePaths));
_logger.LogDebug("Committed {@filePaths}", _filePaths);
}
public void Dispose()