Skip to content

Conversation

@ParidelPooya
Copy link
Contributor

Make the log() method optional in the Logger interface to enable compatibility with popular TypeScript logging libraries like AWS Powertools Logger, Pino, and Winston, which don't implement a generic log() method.

Changes:

  • Made Logger.log() optional in interface definition
  • Updated context-logger to conditionally create log method
  • Updated mode-aware-logger to handle optional log method
  • Fixed all tests to use optional chaining for log() calls

This is a non-breaking change that maintains backward compatibility with existing custom loggers while enabling easier integration with external logging libraries.

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

…atibility

Make the log() method optional in the Logger interface to enable
compatibility with popular TypeScript logging libraries like AWS
Powertools Logger, Pino, and Winston, which don't implement a
generic log() method.

Changes:
- Made Logger.log() optional in interface definition
- Updated context-logger to conditionally create log method
- Updated mode-aware-logger to handle optional log method
- Fixed all tests to use optional chaining for log() calls
- Added LOGGER_COMPATIBILITY.md with usage examples

This is a non-breaking change that maintains backward compatibility
with existing custom loggers while enabling easier integration with
external logging libraries.
@ParidelPooya ParidelPooya merged commit 034b790 into development Nov 13, 2025
7 checks passed
@ParidelPooya ParidelPooya deleted the feat/sdk-optional-logger-log-method branch November 13, 2025 19:53
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.

2 participants