You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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 version2.4.3
in yourcsproj
.Note
Using
LogEvent
,Custom Log Formatter
features, or serialize your own types when Logging events? You need to make changes in your LambdaMain
method.Replace
SourceGeneratorLambdaJsonSerializer
withPowertoolsSourceGeneratorSerializer
.When you update your code to use
PowertoolsSourceGeneratorSerializer<MyCustomJsonSerializerContext>
, we combine yourJsonSerializerContext
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
toPowertoolsSourceGeneratorSerializer
instead of using the staticLogger.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
📜 Documentation updates
🔧 Maintenance
This release was made possible by the following contributors:
@hjgraca
This discussion was created from the release 1.14.
Beta Was this translation helpful? Give feedback.
All reactions