Skip to content

opentelemetry-api: review get_logger documentation #4507

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

Merged
merged 2 commits into from
May 7, 2025
Merged
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
21 changes: 11 additions & 10 deletions opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,30 @@ def get_logger(
) -> Logger:
"""Returns a `Logger` for use by the given instrumentation library.

For any two calls it is undefined whether the same or different
`Logger` instances are returned, even for different library names.
For any two calls with identical parameters, it is undefined whether the same
or different `Logger` instances are returned.

This function may return different `Logger` types (e.g. a no-op logger
vs. a functional logger).

Args:
name: The name of the instrumenting module.
``__name__`` may not be used as this can result in
different logger names if the loggers are in different files.
It is better to use a fixed string that can be imported where
needed and used consistently as the name of the logger.

This should *not* be the name of the module that is
instrumented but the name of the module doing the instrumentation.
name: The name of the instrumenting module, package or class.
This should *not* be the name of the module, package or class that is
instrumented but the name of the code doing the instrumentation.
E.g., instead of ``"requests"``, use
``"opentelemetry.instrumentation.requests"``.

For log sources which define a logger name (e.g. logging.Logger.name)
the Logger Name should be recorded as the instrumentation scope name.

version: Optional. The version string of the
instrumenting library. Usually this should be the same as
``importlib.metadata.version(instrumenting_library_name)``.

schema_url: Optional. Specifies the Schema URL of the emitted telemetry.

attributes: Optional. Specifies the instrumentation scope attributes to
associate with emitted telemetry.
"""


Expand Down