Anyone have experience with AWS Swift Lambda's not printing to the console?

I have this code:

print("Parsed endpoint: \(endpoint.rawValue)")

But it never prints to the CloudWatch logs. However, if I replace it with this:

context.logger.log(level: .info, "Parsed endpoint: \(endpoint.rawValue)")

Then it prints every single time.

I tried it in another runtime (Python) and using the basic print command provided by Python logs to CloudWatch just fine. The problem is context.logger.log(level:_:) includes more info then I want so I have to filter it when processing the console output. I would prefer to just be able to use print statements like you can in any other runtime. THIS IS DISCRIMINATION!!! :upside_down_face:

Anyone know why using print() in Swift Lambda's doesn't work? There's no issue with the \(endpoint.rawValue) code.

1 Like

You probably need to flush the buffer with