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
Copy file name to clipboardExpand all lines: docs/core/logging.md
+9-15
Original file line number
Diff line number
Diff line change
@@ -670,22 +670,19 @@ You can customize the structure (keys and values) of your log entries by impleme
670
670
671
671
## AOT Support
672
672
673
-
Logging utility supports native AOT serialization by default without any changes needed.
674
-
675
673
!!! info
676
674
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.
675
+
If you want to use the `LogEvent`, `Custom Log Formatter` features, or serialize your own types when Logging events, you need to make changes in your Lambda `Main` method.
679
676
680
677
!!! info
681
678
682
-
Starting from version 1.6.0 it is required to update `Amazon.Lambda.Serialization.SystemTextJson` to `version 2.4.3` in your `csproj`.
679
+
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.
683
680
684
681
### Configure
685
682
686
-
The change needed is to replace `SourceGeneratorLambdaJsonSerializer` with `PowertoolsSourceGeneratorSerializer`.
683
+
Replace `SourceGeneratorLambdaJsonSerializer` with `PowertoolsSourceGeneratorSerializer`.
687
684
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.
685
+
This change enables Powertools to construct an instance of `JsonSerializerOptions`used to customize the serialization and deserialization of Lambda JSON events and your own types.
689
686
690
687
=== "Before"
691
688
@@ -726,13 +723,11 @@ public partial class MyCustomJsonSerializerContext : JsonSerializerContext
726
723
}
727
724
```
728
725
729
-
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.
726
+
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.
731
727
732
728
### Custom Log Formatter
733
729
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.
730
+
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.
736
731
737
732
=== "Function Main method"
738
733
@@ -790,8 +785,7 @@ instead of using the static `Logger.UseFormatter` in the Function contructor.
790
785
### Anonymous types
791
786
792
787
!!! note
793
-
794
-
Although we support anonymous type serialization by converting to a `Dictionary<string, object>`,
795
-
this is not a best practice and is not recommendede when using native AOT.
796
788
797
-
Recommendation is to use concrete classes and add them to your `JsonSerializerContext`.
789
+
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.
790
+
791
+
We recommend using concrete classes and adding them to your `JsonSerializerContext`.
0 commit comments