File tree Expand file tree Collapse file tree
src/MediaConverters/MediaConverters.Lib/Imaging/Optimizations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
2+ using System . Diagnostics ;
23using System . IO ;
34
45namespace DotNetCampus . MediaConverters . Imaging . Optimizations ;
@@ -13,6 +14,8 @@ namespace DotNetCampus.MediaConverters.Imaging.Optimizations;
1314public readonly record struct ImageFileOptimizationContext ( FileInfo ImageFile ,
1415 DirectoryInfo WorkingFolder , int ? MaxImageWidth = null , int ? MaxImageHeight = null )
1516{
17+ public Stopwatch TotalStopwatch { get ; } = Stopwatch . StartNew ( ) ;
18+
1619 public string TraceId { get ; init ; } = Guid . NewGuid ( ) . ToString ( "N" ) ;
1720
1821 public bool ShouldLogToConsole { get ; init ; } = false ;
@@ -30,7 +33,7 @@ public void LogMessage(string message)
3033
3134 if ( ShouldLogToConsole )
3235 {
33- Console . WriteLine ( message ) ;
36+ Console . WriteLine ( $ " { message } Total Cost { TotalStopwatch . ElapsedMilliseconds } ms" ) ;
3437 }
3538
3639 if ( ShouldLogToFile )
You can’t perform that action at this time.
0 commit comments