Skip to content

1.4.2

Compare
Choose a tag to compare
@github-actions github-actions released this 22 Aug 18:26
· 1145 commits to refs/heads/develop since this release
1378d75

Summary

In this release we are excited to announce the release of custom log formatter support. You can customize the structure (keys and values) of your log entries by implementing a custom log formatter and override default log formatter using Logger.UseFormatter method. You can implement a custom log formatter by inheriting the ILogFormatter class and implementing the object FormatLogEntry(LogEntry logEntry) method.

We are also happy to announce the support for adding the Idempotent attribute on any method, not only the Lambda handler.

We also removed Moq library from our tests and replaced it with NSubsitute due to privacy concerns

We also made improvements to how we handle when an exception is thrown inside a method that is decorated with Powertools utilities the user should see the full stack trace for that exception.

Note
This change required us to update all utilities (Common). To avoid issues please update to the latest version all utilities you are using in your projects.
We are working to remove the dependency on Common (#339)

Custom log formatter

  • Create a class that implements ILogFormatter
    image

  • Call method Logger.UseFormatter on Lambda function constructor
    image

  • Example CloudWatch Logs
    image

Idempotent attribute on another method

You can use the Idempotent attribute for any .NET function, not only the Lambda handlers.
When using Idempotent attribute on another method, you must tell which parameter in the method signature has the data we should use:

  • If the method only has one parameter, it will be used by default.
  • If there are 2 or more parameters, you must set the IdempotencyKey attribute on the parameter to use.

image

Full list of changes

🌟New features and non-breaking changes

📜 Documentation updates

  • docs: Clarify why we currently prefer X-Ray over ADOT in Tracing (#347) by @hjgraca

🐛 Bug and hot fixes

  • fix: Stack trace lost when exception is thrown the when using decorator (#357) by @hjgraca

🔧 Maintenance

  • chore: Idempotency - refactor example to be simpler with a comparable idempotent output (#342) by @hjgraca
  • chore: Replace Moq NuGet package with NSubstitute (#370) by @amirkaws
  • chore(deps): bump AWSSDK.SecretsManager from 3.7.102.38 to 3.7.200.3 in /libraries (#359) by @dependabot
  • chore(deps): bump xunit from 2.4.1 to 2.4.2 in /libraries (#328) by @dependabot
  • chore(deps): bump AWSSDK.DynamoDBv2 from 3.7.103.1 to 3.7.104.1 in /libraries (#327) by @dependabot
  • chore(deps): bump AWSXRayRecorder.Core from 2.13.0 to 2.14.0 in /libraries (#325) by @dependabot
  • chore(deps): bump Testcontainers from 3.2.0 to 3.3.0 in /libraries (#326) by @dependabot
  • chore(deps): bump Moq from 4.18.1 to 4.18.4 in /libraries (#329) by @dependabot

This release was made possible by the following contributors:

@amirkaws, @hjgraca and @hossambarakat