Skip to content

Commit f47f57d

Browse files
committed
Add instrumentation example to logging
1 parent 6114b60 commit f47f57d

File tree

1 file changed

+17
-0
lines changed
  • instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging

1 file changed

+17
-0
lines changed

instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@
1414

1515
# pylint: disable=empty-docstring,no-value-for-parameter,no-member,no-name-in-module
1616

17+
"""
18+
The OpenTelemetry `logging` integration automatically injects tracing context into
19+
log statements.
20+
21+
Usage
22+
-----
23+
.. code-block:: python
24+
25+
import logging
26+
27+
from opentelemetry.instrumentation.logging import LoggingInstrumentor
28+
29+
LoggingInstrumentor().instrument()
30+
31+
logging.warning('OTel test')
32+
"""
33+
1734
import logging # pylint: disable=import-self
1835
from os import environ
1936
from typing import Collection

0 commit comments

Comments
 (0)