Comments (2)
Need to play with it a bit! :)
- Implementation: Not sure if a special log writer needs to be implemented to make Lambda recognize the levels, or if there's magic that makes it work out of the box parsing standard out. Ref Java: https://github.com/aws/aws-lambda-java-libs/blob/main/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/logging/FramedTelemetryLogSink.java
- Design: Not sure if the current built in log.Println and log.Fatal should match the AWS_LAMBDA_LOG_LEVEL (end thus always be present), or have their level defaulted to INFO, and be configurable via like
StartWithOptions(..., lambda.WithLogLevel(...))
- Design: Ditto for
AWS_LAMBDA_LOG_FORMAT
. Leaning towardslambda.WithLogFormat(...)
for backwards compat sake. And then there's ensuring that whatever the JSON format for errors looks like is consistent with the other runtimes
from aws-lambda-go.
Thanks for taking a peek!
Not sure if a special log writer needs to be implemented to make Lambda recognize the levels
Nothing special is required - as long as level
is a top-level JSON key in an entry from standard out, it will omit logs based on the function's AWS_LAMBDA_LOG_LEVEL
setting. So you can (technically) spew all kinds of debug logging that just won't make it to CloudWatch Logs if you're set to error
level. In app logs that can get expensive though if you're debug logging massive structs as JSON or whatever, so in my code above I'm passing the AWS_LAMBDA_LOG_LEVEL
to slog
, which is smart about bailing early before calling MarshalJSON on log args.
Not sure if the current built in log.Println and log.Fatal should match
I'm not sure about that either. It's really only an issue if those calls are / can be expensive, but I didn't see it doing anything substantial except for panic recovery and trace info, which is exactly what I'm hoping to get here.
And then there's ensuring that whatever the JSON format for errors looks like is consistent with the other runtimes
There's a doc - scroll to the "JSON format for application logs" section - they detail how the shape looks in the managed runtimes (don't even get me started on time
vs timestamp
being different between the platform and application logs, come on!). There's also a "Application log-level filtering with custom runtimes" section on that same page I can't link directly to with the ENV var stuff.
from aws-lambda-go.
Related Issues (20)
- ALB target grouped Lambda returns fine but alb return 502 error that "LambdaInvalidResponse" HOT 2
- Deserialisation of array values in Cognito events custom UserAttributes not working correctly HOT 1
- please add a mocked example HOT 1
- Custom runtime provided.al2 broken on v1.42 HOT 1
- Add IoTCoreMQTTMessage to aws/aws-lambda-go/events
- Add disconnectStatusCode to event/APIGatewayWebsocketProxyRequestContext
- RequestContext.Authorizer differs between REST gateway vs HTTP gateway
- UnmarshalTypeError on CodePipelineEventBridgeEvent HOT 4
- Missing field enableSMSMFA on struct events.CognitoEventUserPoolsMigrateUserResponse
- Runtime.InvalidEntrypoint
- Add AWS CloudWatch Alarm Event
- Implement `MultiValueHeaders` for ``events.LambdaFunctionURLResponse``
- Small improvement in APIGatewayWebsocketProxyRequestContext.Authorizer
- [BUG] Traceability panic error memory address runtime al2023
- Getting Segmentation Fault while using Lambda function with SAM Server
- Lambda Function Not Routing Correctly with API Gateway
- Please export extensionAPIClient HOT 1
- events.EventBridgeEvent is returning an empty payload when called by the EventBridge Scheduler HOT 1
- Deadline is set to invoke timestamp, possibly incorrect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-lambda-go.