Skip to content

Commit c69e0ea

Browse files
committed
update logging aot docs
1 parent 335eef7 commit c69e0ea

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

docs/core/logging.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -670,22 +670,19 @@ You can customize the structure (keys and values) of your log entries by impleme
670670

671671
## AOT Support
672672

673-
Logging utility supports native AOT serialization by default without any changes needed.
674-
675673
!!! info
676674

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.
679676

680677
!!! info
681678

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.
683680

684681
### Configure
685682

686-
The change needed is to replace `SourceGeneratorLambdaJsonSerializer` with `PowertoolsSourceGeneratorSerializer`.
683+
Replace `SourceGeneratorLambdaJsonSerializer` with `PowertoolsSourceGeneratorSerializer`.
687684

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.
689686

690687
=== "Before"
691688

@@ -726,13 +723,11 @@ public partial class MyCustomJsonSerializerContext : JsonSerializerContext
726723
}
727724
```
728725

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.
731727

732728
### Custom Log Formatter
733729

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.
736731

737732
=== "Function Main method"
738733

@@ -790,8 +785,7 @@ instead of using the static `Logger.UseFormatter` in the Function contructor.
790785
### Anonymous types
791786

792787
!!! 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.
796788

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

Comments
 (0)