@@ -35,14 +35,15 @@ export class DefaultEventQueue implements IEventQueue {
3535 return ;
3636 }
3737
38+ var queueNotProcessed = 'The queue will not be processed.' ;
3839 this . _config . log . info ( 'Processing queue...' ) ;
3940 if ( ! this . _config . enabled ) {
40- this . _config . log . info ( ' Configuration is disabled. The queue will not be processed.' ) ;
41+ this . _config . log . info ( ` Configuration is disabled. ${ queueNotProcessed } ` ) ;
4142 return ;
4243 }
4344
4445 if ( ! this . _config . apiKey || this . _config . apiKey . length < 10 ) {
45- this . _config . log . info ( 'ApiKey is not set. The queue will not be processed.' ) ;
46+ this . _config . log . info ( `Invalid Api Key. ${ queueNotProcessed } ` ) ;
4647 return ;
4748 }
4849
@@ -51,7 +52,6 @@ export class DefaultEventQueue implements IEventQueue {
5152 try {
5253 var events = this . _config . storage . get ( this . queuePath ( ) , this . _config . submissionBatchSize ) ;
5354 if ( ! events || events . length == 0 ) {
54- this . _config . log . info ( 'There are currently no queued events to process.' ) ;
5555 this . _processingQueue = false ;
5656 return ;
5757 }
@@ -63,15 +63,16 @@ export class DefaultEventQueue implements IEventQueue {
6363 this . _processingQueue = false ;
6464 } ) ;
6565 } catch ( ex ) {
66- this . _config . log . error ( `An error occurred while processing the queue: ${ ex } ` ) ;
66+ this . _config . log . error ( `Error processing queue: ${ ex } ` ) ;
6767 this . suspendProcessing ( ) ;
6868 this . _processingQueue = false ;
6969 }
7070 }
7171
7272 private processSubmissionResponse ( response :SubmissionResponse , events :IEvent [ ] ) : void {
73+ var noSubmission = 'The event will not be submitted.' ;
7374 if ( response . success ) {
74- this . _config . log . info ( `Sent ${ events . length } events to ${ this . _config . serverUrl } .` ) ;
75+ this . _config . log . info ( `Sent ${ events . length } events.` ) ;
7576 return ;
7677 }
7778
@@ -92,7 +93,7 @@ export class DefaultEventQueue implements IEventQueue {
9293
9394 if ( response . unableToAuthenticate ) {
9495 // The api key was suspended or could not be authorized.
95- this . _config . log . info ( ' Unable to authenticate, please check your configuration. The event will not be submitted.' ) ;
96+ this . _config . log . info ( ` Unable to authenticate, please check your configuration. ${ noSubmission } ` ) ;
9697 this . suspendProcessing ( 15 ) ;
9798 return ;
9899 }
@@ -105,19 +106,20 @@ export class DefaultEventQueue implements IEventQueue {
105106 }
106107
107108 if ( response . requestEntityTooLarge ) {
109+ var message = 'Event submission discarded for being too large.' ;
108110 if ( this . _config . submissionBatchSize > 1 ) {
109- this . _config . log . error ( 'Event submission discarded for being too large. The event will be retried with a smaller events size.' ) ;
111+ this . _config . log . error ( ` ${ message } Retrying with smaller batch size.` ) ;
110112 this . _config . submissionBatchSize = Math . max ( 1 , Math . round ( this . _config . submissionBatchSize / 1.5 ) ) ;
111113 this . requeueEvents ( events ) ;
112114 } else {
113- this . _config . log . error ( 'Event submission discarded for being too large. The event will not be submitted.' ) ;
115+ this . _config . log . error ( ` ${ message } ${ noSubmission } ` ) ;
114116 }
115117
116118 return ;
117119 }
118120
119121 if ( ! response . success ) {
120- this . _config . log . error ( `An error occurred while submitting events: ${ response . message } ` ) ;
122+ this . _config . log . error ( `Error submitting events: ${ response . message } ` ) ;
121123 this . suspendProcessing ( ) ;
122124 this . requeueEvents ( events ) ;
123125 }
0 commit comments