Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

1.14 #651

Unanswered
hjgraca asked this question in General
1.14 #651
Sep 24, 2024 · 0 comments
Discussion options

Summary

We are excited to announce GA support for Ahead-of-Time (AOT) compilation for Logging version 1.6.0. You can now use Logging in your AOT-published .NET AWS Lambda functions without any AOT warnings.

With this release, all Powertools core utilities (Logging, Metrics, and Tracing) have AOT support.
You can follow progress on AOT support here.

Check our docs for AOT support details.

Tip

New to AOT?
Check out this tutorial in the AWS Lambda documentation.

Serialization

Important

Starting from version 1.6.0, it is required to update the Amazon.Lambda.Serialization.SystemTextJson NuGet package to version 2.4.3 in your csproj.

Note

Using LogEvent, Custom Log Formatter features, or serialize your own types when Logging events? You need to make changes in your Lambda Main method.
Replace SourceGeneratorLambdaJsonSerializer with PowertoolsSourceGeneratorSerializer.
When you update your code to use PowertoolsSourceGeneratorSerializer<MyCustomJsonSerializerContext>, we combine your JsonSerializerContext with Powertools' JsonSerializerContext. This allows Powertools to serialize your types and Lambda events.

image

Custom Log Formatter

Important

To use a custom log formatter with AOT, pass an instance of ILogFormatter to PowertoolsSourceGeneratorSerializer instead of using the static Logger.UseFormatter in the Function constructor as you do in non-AOT Lambdas.

image

Anonymous Types

While we support anonymous type serialization by converting to a Dictionary<string, object>, this is not a best practice and is not recommended when using native AOT.
We recommend using concrete classes and adding them to your JsonSerializerContext.

Changes

🚀 Features

📜 Documentation updates

🔧 Maintenance

This release was made possible by the following contributors:

@hjgraca


This discussion was created from the release 1.14.
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /