-
Notifications
You must be signed in to change notification settings - Fork 32
-
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.
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.
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
- chore: Logging AOT Support (chore: Logging AOT Support #628 ) by @hjgraca
📜 Documentation updates
- chore: Logging AOT Support (chore: Logging AOT Support #628 ) by @hjgraca
- chore: update logging aot docs (chore: update logging aot docs #649 ) by @hjgraca
🔧 Maintenance
- chore: Update examples for release 1..13 (chore: Update examples for release 1..13 #645 ) by @hjgraca
- chore: Refactor and simplify Common dependency. (chore: Refactor and simplify Common dependency. #643 ) by @hjgraca
- chore: Change the way we reference Common and JMESPath (internal references). (chore: Change the way we reference Common and JMESPath (internal references). #641 ) by @hjgraca
This release was made possible by the following contributors:
This discussion was created from the release 1.14.
Beta Was this translation helpful? Give feedback.