Skip to content

Conversation

@anzheyazzz
Copy link
Contributor

Issue #, if available:

Description of changes:

Adding helper for structured logging so users can log as JSON with slog easier than before.
LogFormatName and LogLevelName are added to context.go as well so it can be easier and cleaner to setup a structured logger as well.

Tests:

Added tests for logger.go

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 95.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.94%. Comparing base (6252f73) to head (32cebc3).

Files with missing lines Patch % Lines
lambdacontext/logger.go 95.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #614      +/-   ##
==========================================
+ Coverage   73.67%   74.94%   +1.27%     
==========================================
  Files          35       36       +1     
  Lines        1341     1401      +60     
==========================================
+ Hits          988     1050      +62     
+ Misses        277      273       -4     
- Partials       76       78       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Rename Handler() to LogHandler()
- Rename LogFormatName/LogLevelName to LogFormat/LogLevel
- Use functional options pattern with WithFields()
- Use Field functions (FieldFunctionARN, FieldTenantID) for immutability
- Add example tests in separate file with go1.21 build tag
bmoffatt
bmoffatt previously approved these changes Jan 15, 2026
Copy link
Collaborator

@bmoffatt bmoffatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bmoffatt bmoffatt merged commit 9dac8a5 into aws:main Jan 15, 2026
27 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants