Skip to content

Conversation

@lilyydu
Copy link
Collaborator

@lilyydu lilyydu commented Feb 4, 2026

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 logging library (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.

  • updated to use module level logging throughout the packages (removed from constructors, dependency injections)
  • kept the ConsoleLogger, but added a deprecation warning
  • kept the LoggerDependencyOption, but added a deprecation warning
    - kept the EventEmitterOptions (though it only has a logger property)
    - kept the ConsoleFormatter and ConsoleFilter as 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)
  • updated common/README to explain how to setup and customize the logger
  • removed mock loggers from tests
  • regenerated the handlers now that logger is no longer a property

to do:

  • discussion on bolded parts above

example w/ standard logger:
image

Copilot AI review requested due to automatic review settings February 4, 2026 22:22
Copy link
Contributor

Copilot AI left a 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__.py files 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

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.

1 participant