diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d3a88ce3dca33e1bd76c6957217f91ac65fb37f..527a722732fcec5e05e2610f1ed77727a87425b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Entity.add_property and Entity.add_parent do not accept `**kwargs`-style keywords anymore. Formerly known keywords have been refactored into named parameters. +* [#35](https://gitlab.com/caosdb/caosdb-pylib/-/issues/35) Loggers now use the name of + the unit where they are called instead of a static name ### Deprecated ### diff --git a/src/caosdb/connection/authentication/interface.py b/src/caosdb/connection/authentication/interface.py index a364aeb564ee929d995b2f8098bd21e30e9733ab..f2cc5001cf8fa0f6d61ec65346f6a200ba0dfcd8 100644 --- a/src/caosdb/connection/authentication/interface.py +++ b/src/caosdb/connection/authentication/interface.py @@ -36,7 +36,7 @@ from caosdb.exceptions import LoginFailedError # meta class compatible with Python 2 *and* 3: ABC = ABCMeta('ABC', (object, ), {'__slots__': ()}) -_LOGGER = logging.getLogger("authentication") +_LOGGER = logging.getLogger(__name__) class AbstractAuthenticator(ABC): diff --git a/src/caosdb/connection/connection.py b/src/caosdb/connection/connection.py index 9e273a56778737033fda9f342f967f56946b501b..6c3946ee639872b0edb0b5b3c30a808cf8c028d4 100644 --- a/src/caosdb/connection/connection.py +++ b/src/caosdb/connection/connection.py @@ -60,7 +60,7 @@ except ImportError: # pylint: disable=missing-docstring -_LOGGER = logging.getLogger("connection") +_LOGGER = logging.getLogger(__name__) class _WrappedHTTPResponse(CaosDBHTTPResponse): diff --git a/unittests/test_authentication_plain.py b/unittests/test_authentication_plain.py index 10cbc418df8bd81c81568a4df0cf1e8a4ac498f8..146b59889c71c86ea77fb4ae962118cdda1afb06 100644 --- a/unittests/test_authentication_plain.py +++ b/unittests/test_authentication_plain.py @@ -65,4 +65,6 @@ def test_subclass_configure(): def test_plain_has_logger(): p = PlainTextCredentialsProvider() assert hasattr(p, "logger") - assert p.logger.name == "authentication" + assert "authentication" in p.logger.name + assert "connection" in p.logger.name + assert "caosdb" in p.logger.name