@@ -84,11 +84,11 @@ public void Stop (bool immediately = false)
8484 var all = ( from sw in workers
8585 select sw . WorkerTask ) . ToArray ( ) ;
8686
87- Console . WriteLine ( "Waiting on Tasks" ) ;
87+ Log . Info ( "Stopping: Waiting on Tasks" ) ;
8888
8989 Task . WaitAll ( all ) ;
9090
91- Console . WriteLine ( "Done Waiting on Tasks" ) ;
91+ Log . Info ( "Stopping: Done Waiting on Tasks" ) ;
9292
9393 workers . Clear ( ) ;
9494 }
@@ -119,7 +119,7 @@ public void ChangeScale (int newScaleSize)
119119 worker . Start ( ) ;
120120 }
121121
122- Console . WriteLine ( "Scaled Changed to: " + workers . Count ) ;
122+ Log . Debug ( "Scaled Changed to: " + workers . Count ) ;
123123 }
124124 }
125125
@@ -185,33 +185,32 @@ public void Start ()
185185 continue ;
186186
187187 try {
188- //Task.WaitAll (toSend.ToArray (), CancelTokenSource.Token);
189- Console . WriteLine ( "Waiting on all tasks {0}" , toSend . Count ( ) ) ;
188+ Log . Info ( "Waiting on all tasks {0}" , toSend . Count ( ) ) ;
190189 await Task . WhenAll ( toSend ) . ConfigureAwait ( false ) ;
191- Console . WriteLine ( "All Tasks Finished" ) ;
190+ Log . Info ( "All Tasks Finished" ) ;
192191 } catch ( Exception ex ) {
193- Console . WriteLine ( "When All Failed" ) ;
192+ Log . Error ( "Waiting on all tasks Failed: {0}" , ex ) ;
194193
195194 }
196- Console . WriteLine ( "Passed WhenAll" ) ;
195+ Log . Info ( "Passed WhenAll" ) ;
197196
198197 } catch ( Exception ex ) {
199- Console . WriteLine ( "Broker.Take: {0}" , ex ) ;
198+ Log . Error ( "Broker.Take: {0}" , ex ) ;
200199 }
201200 }
202201
203202 if ( CancelTokenSource . IsCancellationRequested )
204- Console . WriteLine ( "CancellationRequested " ) ;
203+ Log . Info ( "Cancellation was requested " ) ;
205204 if ( Broker . IsCompleted )
206- Console . WriteLine ( "IsCompleted" ) ;
205+ Log . Info ( "Broker IsCompleted" ) ;
207206
208- Console . WriteLine ( "Task Ended" ) ;
207+ Log . Debug ( "Broker Task Ended" ) ;
209208 } , CancelTokenSource . Token , TaskCreationOptions . LongRunning | TaskCreationOptions . DenyChildAttach , TaskScheduler . Default ) . Unwrap ( ) ;
210209
211210 WorkerTask . ContinueWith ( t => {
212211 var ex = t . Exception ;
213212 if ( ex != null )
214- Console . WriteLine ( "ServiceWorker.WorkerTask: {0}" , ex ) ;
213+ Log . Error ( "ServiceWorker.WorkerTask Error : {0}" , ex ) ;
215214 } , TaskContinuationOptions . OnlyOnFaulted ) ;
216215 }
217216
0 commit comments