Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Features Added

- Add more diagnostic log options
([#39701](https://github.com/Azure/azure-sdk-for-python/pull/39701))
- Only add OpenTelemetry LoggingHandler if current logger does not have it
([#38549](https://github.com/Azure/azure-sdk-for-python/pull/38549))
- Distro to automatically configure event logger provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,23 @@
_SUBSCRIPTION_ID = _SUBSCRIPTION_ID_ENV_VAR.split("+")[0] if _SUBSCRIPTION_ID_ENV_VAR else None
_logger = logging.getLogger(__name__)
_logger.propagate = False
_logger.setLevel(logging.INFO)
_logger.setLevel(logging.DEBUG)
_DIAGNOSTIC_LOG_PATH = _get_log_path()

_DISTRO_DETECTS_ATTACH = "4100"
_INFO = "4101"
_INSTRUMENTATION_SKIPPED = "4101"

_ATTACH_SUCCESS_DISTRO = "4200"
_ATTACH_SUCCESS_CONFIGURATOR = "4201"
_INSTRUMENTATION_SUCCEEDED = "4202"

_DEPENDENCY_OVERLAP = "4300"

_ATTACH_FAILURE_DISTRO = "4400"
_ATTACH_FAILURE_CONFIGURATOR = "4401"
_ATTACH_DETECTS_SDK = "4402"
_INSTRUMENTATION_FAILED = "4403"


class AzureDiagnosticLogging:
Expand Down Expand Up @@ -69,6 +78,11 @@ def _initialize(cls):
_logger.addHandler(f_handler)
AzureDiagnosticLogging._initialized = True

@classmethod
def debug(cls, message: str, message_id: str):
AzureDiagnosticLogging._initialize()
_logger.debug(message, extra={"msgId": message_id})

@classmethod
def info(cls, message: str, message_id: str):
AzureDiagnosticLogging._initialize()
Expand Down