launchdarkly / api-client-python

LaunchDarkly API Client for Python
Other
5 stars 8 forks source link

log.warn is deprecated, use log.warning #4

Closed ToddBradley closed 3 years ago

ToddBradley commented 3 years ago

The modern Python logging subsystems (Python 2.3+ and 3.x) use log.warning instead of log.warn. When I configure the Launch Darkly logger to log output, I see errors like this:

/root/.local/lib/python3.8/site-packages/ldclient/client.py:286: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    log.warn("Feature Flag evaluation attempted before client has initialized! Feature store unavailable - returning default: "

You should update the Python SDK to use the current way of logging warnings.

bwoskow-ld commented 3 years ago

This library is auto-generated from a Swagger (later renamed as OpenAPI) code generator. As a result it is very difficult to change specific details like this in the resulting library implementations.

The good news is that we plan on moving to a newer major version of the code generator in the upcoming months. I can't promise that this is updated in the newer major version, but it is possible.

UPDATE: Eli is right -- this request is about a code maintained in a different repository, and my comment was wrong. I didn't read the log output closely enough to notice.

eli-darkly commented 3 years ago

@bwoskow-ld I think actually this issue was meant to be for https://github.com/launchdarkly/python-server-sdk, not api-client-python. That's apparent from the log output in the PR description.

eli-darkly commented 3 years ago

@ToddBradley: The api-client-python project is not the LaunchDarkly Python SDK; It's a Python client for the low-level LaunchDarkly REST API.

As for the logging issue you mentioned— this sounds like a bug that was fixed quite a while ago in the 6.9.3 release. What version of the SDK are you using?

ToddBradley commented 3 years ago

Whew, this issue is a big hot mess. Thanks for bearing with me, and sorry for wasting your time.

First, you're right that the software I'm using is python-server-sdk, so I reported this issue in the wrong place.

Second, I inherited my project from someone else and just assumed the project dependencies (requirements.txt) were reasonably up to date. But now I see that we were using a version of the SDK that's two years old and not even named the right thing (it was still using ldclient-py instead of launchdarkly-server-sdk). So this isn't really an issue anymore anyhow.

Thanks again. I'm gonna close this issue.