Skip to content

Lambda Logging improvements #2062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Lambda Logging improvements #2062

wants to merge 2 commits into from

Conversation

normj
Copy link
Member

@normj normj commented May 2, 2025

Issue #, if available:
#2032

Description of changes:

  • In Amazon.Lambda.Logging.AspNetCore convert the ASP.NET Core log level into the Lambda log level and then pass the level into the logging method
  • Update Amazon.Lambda.TestUtitlies to have implementation of the newer logging methods
  • Add a new static global static logging method that takes in log level, message, parameters and exception.
  • Passing in exception in the global static logger was missing.

I had also wanted to update Amazon.Lambda.Logging.AspNetCore to support converting the log method to JSON if that was enabled in Lambda. Since we are missing the global static logging method that takes in exception I couldn't do that without losing the exception in the log. Once that new method added in RuntimeSupport in this PR is deployed to the managed runtimes I can go back and add the support.

I updated Amazon.Lambda.Logging.AspNetCore and Amazon.Lambda.TestUtitlies to target .NET 6.0 and .NET 8.0 instead of .NET Standard 2.0. That was needed so I have access to the parameterized logging methods. I didn't do it as a major version bump because I figured where else could you have run these packages then one of those targets. I don't feel to strong on that and if others feel I should do it as a major version bump I'm okay with that.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

normj added 2 commits May 2, 2025 14:18
In Amazon.Lambda.Logging.AspNetCore convert the ASP.NET Core log level into the Lambda log level and then pass the level into the logging method
Update Amazon.Lambda.TestUtitlies to have implementation of the newer logging methods
Add a new static global static logging method that takes in log level, message, parameters and exception. Passing in exception in the global static logger was missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant