33// See the LICENSE file in the project root for more information
44
55using System . Collections . Concurrent ;
6+ using System . Text . Json ;
67using Amazon . Lambda . Core ;
78using Amazon . Lambda . RuntimeSupport ;
89using Amazon . Lambda . Serialization . SystemTextJson ;
910using Amazon . Lambda . SQSEvents ;
1011using Amazon . S3 ;
1112using Amazon . S3 . Util ;
12- using Elastic . Documentation ;
1313using Elastic . Documentation . Lambda . LinkIndexUploader ;
1414using Elastic . Documentation . Links ;
1515
@@ -30,6 +30,8 @@ static async Task<SQSBatchResponse> Handler(SQSEvent ev, ILambdaContext context)
3030 var batchItemFailures = new List < SQSBatchResponse . BatchItemFailure > ( ) ;
3131 foreach ( var message in ev . Records )
3232 {
33+ context . Logger . LogInformation ( "Processing message {MessageId}" , message . MessageId ) ;
34+ context . Logger . LogInformation ( "Message body: {MessageBody}" , message . Body ) ;
3335 try
3436 {
3537 var s3RecordLinkReferenceTuples = await GetS3RecordLinkReferenceTuples ( s3Client , message , context ) ;
@@ -55,6 +57,8 @@ static async Task<SQSBatchResponse> Handler(SQSEvent ev, ILambdaContext context)
5557 var response = new SQSBatchResponse ( batchItemFailures ) ;
5658 if ( batchItemFailures . Count > 0 )
5759 context . Logger . LogInformation ( "Failed to process {batchItemFailuresCount} of {allMessagesCount} messages. Returning them to the queue." , batchItemFailures . Count , ev . Records . Count ) ;
60+ var jsonStr = JsonSerializer . Serialize ( response , SerializerContext . Default . SQSBatchResponse ) ;
61+ context . Logger . LogInformation ( jsonStr ) ;
5862 return response ;
5963 }
6064 catch ( Exception ex )
@@ -67,6 +71,8 @@ static async Task<SQSBatchResponse> Handler(SQSEvent ev, ILambdaContext context)
6771 {
6872 ItemIdentifier = r . MessageId
6973 } ) . ToList ( ) ) ;
74+ var jsonStr = JsonSerializer . Serialize ( response , SerializerContext . Default . SQSBatchResponse ) ;
75+ context . Logger . LogInformation ( jsonStr ) ;
7076 return response ;
7177 }
7278}
0 commit comments