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
@@ -166,6 +173,10 @@ When debugging in non-production environments, you can instruct Logger to log th
166
173
167
174
You can set a Correlation ID using `CorrelationIdPath` parameter by passing a [JSON Pointer expression](https://datatracker.ietf.org/doc/html/draft-ietf-appsawg-json-pointer-03){target="_blank"}.
168
175
176
+
!!! Attention
177
+
The JSON Pointer expression is `case sensitive`. In the bellow example `/headers/my_request_id_header` would work but `/Headers/my_request_id_header` would not find the element.
178
+
179
+
169
180
=== "Function.cs"
170
181
171
182
```c# hl_lines="6"
@@ -656,3 +667,131 @@ You can customize the structure (keys and values) of your log entries by impleme
656
667
}
657
668
}
658
669
```
670
+
671
+
## AOT Support
672
+
673
+
Logging utility supports native AOT serialization by default without any changes needed.
674
+
675
+
!!! info
676
+
677
+
In case you want to use the `LogEvent`, `Custom Log Formatter` features or serialize your own types when Logging events it is required
678
+
that you do some changes in your Lambda `Main` method.
679
+
680
+
!!! info
681
+
682
+
Starting from version 1.6.0 it is required to update `Amazon.Lambda.Serialization.SystemTextJson` to `version 2.4.3` in your `csproj`.
683
+
684
+
### Configure
685
+
686
+
The change needed is to replace `SourceGeneratorLambdaJsonSerializer` with `PowertoolsSourceGeneratorSerializer`.
687
+
688
+
This change enables Powertools to construct an instance of JsonSerializerOptions that is used to customize the serialization and deserialization of the Lambda JSON events and your own types.
When you change to `PowertoolsSourceGeneratorSerializer<MyCustomJsonSerializerContext>` we are
730
+
combining your `JsonSerializerContext` types with Powertools `JsonSerializerContext`. This allows Powertools to serialize your types and Lambda events.
731
+
732
+
### Custom Log Formatter
733
+
734
+
To be able to use a custom log formatter with AOT we need to pass an instance of ` ILogFormatter` to `PowertoolsSourceGeneratorSerializer`
735
+
instead of using the static `Logger.UseFormatter` in the Function contructor.
<!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. -->
0 commit comments