@@ -238,13 +238,20 @@ def invoke(self, *, invocation: Invocation) -> InvocationResult:
238
238
)
239
239
# TODO: consider using the same prefix logging as in error case for execution environment.
240
240
# possibly as separate named logger.
241
- LOG .debug ("Got logs for invocation '%s'" , invocation .request_id )
242
- for log_line in invocation_result .logs .splitlines ():
243
- LOG .debug (
244
- "[%s-%s] %s" ,
245
- function_id .function_name ,
241
+ if invocation_result .logs is not None :
242
+ LOG .debug ("Got logs for invocation '%s'" , invocation .request_id )
243
+ for log_line in invocation_result .logs .splitlines ():
244
+ LOG .debug (
245
+ "[%s-%s] %s" ,
246
+ function_id .function_name ,
247
+ invocation .request_id ,
248
+ truncate (log_line , config .LAMBDA_TRUNCATE_STDOUT ),
249
+ )
250
+ else :
251
+ LOG .warning (
252
+ "[%s] Error while printing logs for function '%s': Received no logs from environment." ,
246
253
invocation .request_id ,
247
- truncate ( log_line , config . LAMBDA_TRUNCATE_STDOUT ) ,
254
+ function_id . function_name ,
248
255
)
249
256
return invocation_result
250
257
@@ -260,7 +267,8 @@ def store_logs(
260
267
self .log_handler .add_logs (log_item )
261
268
else :
262
269
LOG .warning (
263
- "Received no logs from invocation with id %s for lambda %s" ,
270
+ "Received no logs from invocation with id %s for lambda %s. Execution environment logs: \n %s " ,
264
271
invocation_result .request_id ,
265
272
self .function_arn ,
273
+ execution_env .get_prefixed_logs (),
266
274
)
0 commit comments