File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Sources/AWSLambdaRuntimeCore Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import NIOCore
2323public final class LambdaRuntime < Handler> : @unchecked Sendable where Handler: StreamingLambdaHandler {
2424 // TODO: We want to change this to Mutex as soon as this doesn't crash the Swift compiler on Linux anymore
2525 let handlerMutex : NIOLockedValueBox < Handler ? >
26- let logger : Logger
26+ var logger : Logger
2727 let eventLoop : EventLoop
2828
2929 public init (
@@ -55,6 +55,11 @@ public final class LambdaRuntime<Handler>: @unchecked Sendable where Handler: St
5555 throw LambdaRuntimeError ( code: . runtimeCanOnlyBeStartedOnce)
5656 }
5757
58+ // by setting the log level here, we understand it can not be changed dynamically at runtime
59+ // developers have to wait for AWS Lambda to dispose and recreate a runtime environment to pickup a change
60+ // this approach is less flexible but more performant than reading the value of the environment variable at each invocation
61+ self . logger. logLevel = Lambda . env ( " LOG_LEVEL " ) . flatMap ( Logger . Level. init) ?? . info
62+
5863 try await LambdaRuntimeClient . withRuntimeClient (
5964 configuration: . init( ip: ip, port: port) ,
6065 eventLoop: self . eventLoop,
You can’t perform that action at this time.
0 commit comments