@@ -4,25 +4,23 @@ const { Client } = require('../Client');
4
4
const { getFolders } = require ( '../utils/selectViewModels' ) ;
5
5
6
6
exports . process = async function process ( msg , cfg , snapshot ) {
7
- this . logger . trace ( 'Incoming configuration: %j' , cfg ) ;
8
- this . logger . trace ( 'Incoming message: %j' , msg ) ;
9
- this . logger . trace ( 'Incoming snapshot: %j' , snapshot ) ;
7
+ this . logger . info ( 'Poll for New Mail trigger starting...' ) ;
10
8
const {
11
9
folderId, startTime, pollOnlyUnreadMail, emitBehavior = 'emitIndividually' ,
12
10
} = cfg ;
13
11
snapshot . lastModifiedDateTime = snapshot . lastModifiedDateTime || startTime || new Date ( 0 ) . toISOString ( ) ;
14
- this . logger . info ( `Getting message from folder with id: ${ folderId } starting from: ${ snapshot . lastModifiedDateTime } , pollOnlyUnreadMail ${ pollOnlyUnreadMail || false } ` ) ;
12
+ this . logger . info ( `Getting message from specified folder, starting from: ${ snapshot . lastModifiedDateTime } , pollOnlyUnreadMail ${ pollOnlyUnreadMail || false } ` ) ;
15
13
const client = new Client ( this , cfg ) ;
16
14
const results = await client . getLatestMessages ( folderId , snapshot . lastModifiedDateTime , pollOnlyUnreadMail ) ;
17
- this . logger . trace ( 'Results: %j' , results ) ;
15
+ this . logger . debug ( 'Results are received' ) ;
18
16
if ( results . length > 0 ) {
19
17
this . logger . info ( `New Mails found, going to emit, Emit Behavior: ${ emitBehavior } ...` ) ;
20
18
switch ( emitBehavior ) {
21
19
case 'emitIndividually' :
22
20
this . logger . info ( 'Starting to emit individually found mails...' ) ;
23
21
// eslint-disable-next-line no-restricted-syntax
24
22
for ( const result of results ) {
25
- this . logger . trace ( 'Emit Mail: %j' , result ) ;
23
+ this . logger . debug ( 'Emit Mail...' ) ;
26
24
// eslint-disable-next-line no-await-in-loop
27
25
await this . emit ( 'data' , messages . newMessageWithBody ( result ) ) ;
28
26
}
0 commit comments