Bug: Logging casing affects nested object properties #417
Labels
area/logging
Core logging utility
not-a-bug
New and existing bug reports incorrectly submitted as bug
v2
v2 release
Milestone
Expected Behaviour
Logger should respect the casing of the of the object it logs, irrespective of the
POWERTOOLS_LOGGER_CASE
configuration. In the following example, the logging attribute logs the Amazon.Lambda.SQSEvents.SQSEvent. In this instance thePOWERTOOLS_LOGGER_CASE
setting is not defined and defaults to snake case (the current default setting, see docs).The log output should be.
Current Behaviour
By default, if you apply the above example, the output would look like this - everything snake case.
Similarly, if you define
POWERTOOLS_LOGGER_CASE
as camel case, you get:In both cases, this is a misrepresentation of the definition of the SQSEvent class.
Code snippet
Possible Solution
Two recommendations:
Do not apply key casing conventions to nested objects. Keep the property definition of the original object. Apply casing configuration to top-level keys only. This includes all extra keys, but not the values of the extra keys.
Make Pascal case the default casing for all keys. This is the default casing for .NET and should be an opt-out if users want something different, rather than it being an opt in.
Steps to Reproduce
Do nothing. Or change the
POWERTOOLS_LOGGER_CASE
to CamelCasePowertools for AWS Lambda (.NET) version
latest
AWS Lambda function runtime
dotnet6
Debugging logs
No response
The text was updated successfully, but these errors were encountered: