-
Notifications
You must be signed in to change notification settings - Fork 13
remove custom logger, use standard logging library #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request migrates the Microsoft Teams SDK from a custom ConsoleLogger implementation to Python's standard logging library. This is a significant refactoring that aligns the SDK with industry standards and improves integration with other Python libraries and frameworks.
Changes:
- Replaced custom ConsoleLogger with module-level loggers using
logging.getLogger(__name__)throughout all packages - Removed logger from constructors and dependency injection across all plugins and components
- Added NullHandler to all package
__init__.pyfiles following Python logging best practices - Added deprecation warnings for ConsoleLogger and LoggerDependencyOptions
- Regenerated activity handlers to remove logger property requirements
- Updated README documentation with comprehensive logging setup examples
- Refactored tests to use pytest's caplog fixture instead of mock loggers
Reviewed changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/openai/src/microsoft_teams/openai/*.py | Migrated to module-level loggers, removed logger from OpenAIBaseModel |
| packages/mcpplugin/src/microsoft_teams/mcpplugin/*.py | Removed logger from constructors, use module-level loggers |
| packages/devtools/src/microsoft_teams/devtools/devtools_plugin.py | Removed logger dependency injection, use module-level logger |
| packages/common/src/microsoft_teams/common/logging/*.py | Added deprecation warnings to ConsoleLogger |
| packages/common/src/microsoft_teams/common/events/event_emitter.py | Removed EventEmitterOptions, use module-level logger |
| packages/common/src/microsoft_teams/common/http/client.py | Removed logger from ClientOptions, use module-level logger |
| packages/apps/src/microsoft_teams/apps/*.py | Removed logger from App, HttpPlugin, ActivityProcessor, and other core components |
| packages/apps/src/microsoft_teams/apps/routing/*.py | Updated ActivityContext and handlers to use module-level logger |
| packages/apps/src/microsoft_teams/apps/auth/*.py | Removed logger from TokenValidator and middleware |
| packages/botbuilder/src/microsoft_teams/botbuilder/*.py | Removed logger dependency injection |
| packages/a2aprotocol/src/microsoft_teams/a2a/*.py | Migrated to module-level loggers |
| packages/*/init.py | Added NullHandler to all package init files |
| packages/common/README.md | Added comprehensive logging documentation |
| packages/apps/tests/*.py | Refactored tests to use caplog instead of mock loggers |
| packages/common/tests/test_backward_compat.py | Updated backward compatibility tests |
| packages/apps/tests/conftest.py | Added logging configuration fixture |
| packages/apps/scripts/generate_handlers.py | Updated handler generation to remove logger references |
…rosoft/teams.py into lilyydu/remove-custom-logger
Previously, we had a custom logger available for customers. However, this didn't integrate very well with the general industry - other libraries and frameworks use python's
logginglibrary (e.g., fastapi, boto3, etc), and most developers are familiar with it. In addition, using the standard library is better for reliability, and requires less maintenance.ConsoleLogger, but added a deprecation warningLoggerDependencyOption, but added a deprecation warning- kept the
EventEmitterOptions(though it only has a logger property)- kept the
ConsoleFormatterandConsoleFilteras an option for developers to use- added the NullHandler so that no logs will show up, unless configured by the developer (added to every package init file)
to do:
example w/ standard logger:
