mirror of
https://github.com/Grace-Solutions/PSMinIO.git
synced 2026-08-29 21:36:53 +00:00
Enhance verbose logging with file counter and full path
✅ IMPROVED VERBOSE LOGGING: � ENHANCED LOG FORMAT: • Changed from: 'Compressed: filename -> size' • Changed to: 'X of Y - FullPath -> size (reduction%, duration)' • Shows current file counter and total file count • Displays full file path instead of just filename • Provides better context for progress tracking � IMPLEMENTATION DETAILS: • Added FullPath property to ZipFileEventArgs • Added _currentFileIndex counter to ZipBuilder • Updated ZipArchiveBuilder to pass fileInfo.FullName • Enhanced OnFileAdded method with counter and full path logging • Maintains all existing compression metrics and timing � EXAMPLE OUTPUT: Before: 'Compressed: file.txt -> 1.2 KB (15.3% reduction, 25ms)' After: '3 of 10 - C:\MyFiles\Documents\file.txt -> 1.2 KB (15.3% reduction, 25ms)' ✅ BENEFITS: • Clear progress indication with file counters • Full file path context for better debugging • Easy identification of which files are being processed • Consistent with collection progress format • Enhanced troubleshooting capabilities Perfect verbose logging for zip operations!
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -333,6 +333,7 @@ namespace PSMinIO.Utils
|
|||||||
OnFileAdded(new ZipFileEventArgs
|
OnFileAdded(new ZipFileEventArgs
|
||||||
{
|
{
|
||||||
FileName = fileInfo.Name,
|
FileName = fileInfo.Name,
|
||||||
|
FullPath = fileInfo.FullName,
|
||||||
EntryName = entryName,
|
EntryName = entryName,
|
||||||
UncompressedSize = fileInfo.Length,
|
UncompressedSize = fileInfo.Length,
|
||||||
CompressedSize = compressedSize,
|
CompressedSize = compressedSize,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace PSMinIO.Utils
|
|||||||
private readonly ThreadSafeProgressCollector _progressCollector;
|
private readonly ThreadSafeProgressCollector _progressCollector;
|
||||||
private bool _disposed = false;
|
private bool _disposed = false;
|
||||||
private int _totalFiles = 0;
|
private int _totalFiles = 0;
|
||||||
|
private int _currentFileIndex = 0;
|
||||||
private readonly List<object> _processedItems = new List<object>();
|
private readonly List<object> _processedItems = new List<object>();
|
||||||
|
|
||||||
// Activity IDs for progress tracking
|
// Activity IDs for progress tracking
|
||||||
@@ -177,8 +178,14 @@ namespace PSMinIO.Utils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnFileAdded(object? sender, ZipFileEventArgs e)
|
private void OnFileAdded(object? sender, ZipFileEventArgs e)
|
||||||
{
|
{
|
||||||
_progressCollector.QueueVerboseMessage("Compressed: {0} -> {1} ({2:F1}% reduction, {3})",
|
// Increment the current file counter
|
||||||
e.FileName,
|
_currentFileIndex++;
|
||||||
|
|
||||||
|
// Log with counter and full path: "Counter of Total - FullPath"
|
||||||
|
_progressCollector.QueueVerboseMessage("{0} of {1} - {2} -> {3} ({4:F1}% reduction, {5})",
|
||||||
|
_currentFileIndex,
|
||||||
|
_totalFiles,
|
||||||
|
e.FullPath,
|
||||||
SizeFormatter.FormatBytes(e.CompressedSize),
|
SizeFormatter.FormatBytes(e.CompressedSize),
|
||||||
e.CompressionEfficiency,
|
e.CompressionEfficiency,
|
||||||
SizeFormatter.FormatDuration(e.ProcessingTime));
|
SizeFormatter.FormatDuration(e.ProcessingTime));
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ namespace PSMinIO.Utils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Full path of the original file
|
||||||
|
/// </summary>
|
||||||
|
public string FullPath { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entry name in the zip archive
|
/// Entry name in the zip archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user