@@ -40,20 +40,41 @@ class RunOptions
4040
4141        static   int  Main ( string [ ]  args ) 
4242        { 
43+             Telemetry . Current . TrackEvent ( "ApplicationStart" ) ; 
44+             DateTime  startTime  =  DateTime . Now ; 
45+             Stopwatch  mainTimer  =  new  Stopwatch ( ) ; 
46+             mainTimer . Start ( ) ; 
47+             ////////////////////////////////////////////////// 
4348            Trace . Listeners . Add ( new  TextWriterTraceListener ( Console . Out ) ) ; 
4449            Trace . Listeners . Add ( new  TextWriterTraceListener ( string . Format ( @"{0}-{1}.log" ,  DateTime . Now . ToString ( "yyyy-MM-dd-HH-mm-ss" ) ,  "MigrationRun" ) ,  "myListener" ) ) ; 
4550            ////////////////////////////////////////////////// 
46-             Stopwatch  stopwatch  =  new  Stopwatch ( ) ; 
47-             stopwatch . Start ( ) ; 
51+             Trace . WriteLine ( System . Reflection . Assembly . GetExecutingAssembly ( ) . GetName ( ) . Name ) ; 
52+             Trace . WriteLine ( System . Reflection . Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version . ToString ( ) ) ; 
53+             Trace . WriteLine ( string . Format ( "Telemitery Enabled: {0}" ,  Telemetry . Current . IsEnabled ( ) . ToString ( ) ) ) ; 
54+             Trace . WriteLine ( string . Format ( "SessionID: {0}" ,  Telemetry . Current . Context . Session . Id ) ) ; 
55+             Trace . WriteLine ( string . Format ( "User: {0}" ,  Telemetry . Current . Context . User . Id ) ) ; 
56+             Trace . WriteLine ( string . Format ( "Start Time: {0}" ,  startTime . ToUniversalTime ( ) ) ) ; 
57+             Trace . WriteLine ( "----------------------------------------------------------------" ) ; 
58+             Trace . WriteLine ( "------------------------------START-----------------------------" ) ; 
59+             Trace . WriteLine ( "----------------------------------------------------------------" ) ; 
4860            ////////////////////////////////////////////////// 
4961            int  result  =  ( int ) Parser . Default . ParseArguments < InitOptions ,  RunOptions > ( args ) . MapResult ( 
5062                ( InitOptions  opts )  =>  RunInitAndReturnExitCode ( opts ) , 
5163                ( RunOptions  opts )  =>  RunExecuteAndReturnExitCode ( opts ) , 
5264                errs =>  1 ) ; 
5365            ////////////////////////////////////////////////// 
54-             Console . WriteLine ( ) ; 
55-             Console . WriteLine ( "Freedom" ) ; 
56-             Console . ReadKey ( ) ; 
66+             Trace . WriteLine ( "----------------------------------------------------------------" ) ; 
67+             Trace . WriteLine ( "-------------------------------END------------------------------" ) ; 
68+             Trace . WriteLine ( "----------------------------------------------------------------" ) ; 
69+             mainTimer . Stop ( ) ; 
70+             Telemetry . Current . TrackEvent ( "ApplicationEnd" ,  null , 
71+                 new  Dictionary < string ,  double >  { 
72+                         {  "ApplicationDuration" ,  mainTimer . ElapsedMilliseconds  } 
73+                 } ) ; 
74+             Telemetry . Current . Flush ( ) ; 
75+             
76+             Trace . WriteLine ( string . Format ( "Duration: {0}" ,  mainTimer . Elapsed . ToString ( "c" ) ) ) ; 
77+             Trace . WriteLine ( string . Format ( "End Time: {0}" ,  startTime . ToUniversalTime ( ) ) ) ; 
5778            return  result ; 
5879        } 
5980
0 commit comments