@@ -41,7 +41,7 @@ public async Task WriteToTargetAsync(Func<Stream, Task> writeToStream, IConfigur
41
41
42
42
logger . LogInformation ( "Saving file '{File}' to Azure Blob Container '{ContainerName}'" , settings . BlobName , settings . ContainerName ) ;
43
43
44
- var lastLogTime = DateTime . MinValue ;
44
+ var lastLogTime = DateTime . UtcNow ;
45
45
var logInterval = TimeSpan . FromMinutes ( 1 ) ;
46
46
long totalBytes = 0 ;
47
47
@@ -54,32 +54,31 @@ public async Task WriteToTargetAsync(Func<Stream, Task> writeToStream, IConfigur
54
54
{
55
55
if ( DateTime . UtcNow - lastLogTime >= logInterval )
56
56
{
57
- logger . LogInformation ( "Transferred {TotalMiB} bytes to Azure Blob" , l / 1024 / 1024 ) ;
57
+ logger . LogInformation ( "{BlobName}: transferred {TotalMiB} MiB to Azure Blob" , settings . BlobName , l / 1024 / 1024 ) ;
58
58
lastLogTime = DateTime . UtcNow ;
59
59
}
60
60
61
61
totalBytes = l ;
62
62
} )
63
63
64
64
} , cancellationToken ) ;
65
+
65
66
await writeToStream ( blobStream ) ;
66
67
67
68
sw . Stop ( ) ;
68
69
69
- var totalMib = totalBytes / 1024 / 1024 ;
70
- var rate = totalMib / sw . ElapsedMilliseconds / 1000 ;
70
+ if ( totalBytes != 0 )
71
+ {
72
+ var totalMib = totalBytes / 1024 / 1024 ;
73
+ var rate = totalMib / sw . ElapsedMilliseconds / 1000 ;
71
74
72
- logger . LogInformation ( "Transferred {TotalMiB} Mib to Azure Blob in {TotalTime} minutes ({Rate} MiB/s)." , totalMib , sw . ElapsedMilliseconds / 1000 / 60 , rate ) ;
75
+ logger . LogInformation ( "{BlobName}: transferred {TotalMiB} Mib to Azure Blob in {TotalTime} minutes ({Rate} MiB/s)." , settings . BlobName , totalMib , sw . ElapsedMilliseconds / 1000 / 60 , rate ) ;
76
+ }
73
77
}
74
78
75
79
public IEnumerable < IDataExtensionSettings > GetSettings ( )
76
80
{
77
81
yield return new AzureBlobSinkSettings ( ) ;
78
82
}
79
-
80
- private void LogBytes ( )
81
- {
82
-
83
- }
84
83
}
85
84
}
0 commit comments