Skip to content

Conversation

@anzheyazzz
Copy link

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 96.77419% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.05%. Comparing base (6252f73) to head (a4e53b2).

Files with missing lines Patch % Lines
lambdacontext/logger.go 96.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #614      +/-   ##
==========================================
+ Coverage   73.67%   75.05%   +1.37%     
==========================================
  Files          35       36       +1     
  Lines        1341     1403      +62     
==========================================
+ Hits          988     1053      +65     
+ Misses        277      273       -4     
- Partials       76       77       +1     

☔ 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
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

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.

3 participants