swift-aws-lambda-runtime icon indicating copy to clipboard operation
swift-aws-lambda-runtime copied to clipboard

Make sure TRACE log level exists in runtime v2

Open sebsto opened this issue 1 year ago • 1 comments

Verify if this change has been kept in v2 https://github.com/swift-server/swift-aws-lambda-runtime/commit/221978224cf82027f46c0aa54def83476fb74412

sebsto avatar Oct 10 '24 10:10 sebsto

@fabianfett

This is the code from v1

            // when log level is trace or lower, print the first Kb of the payload
            if logger.logLevel <= .trace, let buffer = bytes.getSlice(at: 0, length: max(bytes.readableBytes, 1024)) {
                logger.trace("sending invocation to lambda handler",
                             metadata: ["1024 first bytes": .string(String(buffer: buffer))])
            } else {
                logger.debug("sending invocation to lambda handler")
            }

Where is the good place to add this code ? Is it in Lambda.runLoop() ?

https://github.com/swift-server/swift-aws-lambda-runtime/blob/main/Sources/AWSLambdaRuntimeCore/Lambda.swift#L39

Or in the Handler ? https://github.com/swift-server/swift-aws-lambda-runtime/blob/main/Sources/AWSLambdaRuntimeCore/LambdaHandlers.swift#L172

sebsto avatar Oct 10 '24 11:10 sebsto