| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
By setting up a handler in the library, the library users do not have a good control on how/where to write the logs. Do not set a handler from the library.
|
we should add docs and do a logging overhaul i think - e.g. https://github.com/testcontainers/testcontainers-java/blob/2707f3143d3cfa8351f727bfd5752c1155818bd6/core/src/main/java/org/testcontainers/containers/GenericContainer.java#L665C1-L672C6 |
Sorry, something went wrong.
|
@alexanderankin what do you mean with a logging overhaul? Logging is always quite language specific as it requires global objects. I am with draftcode that a libary should not setup a logger, it only should log. I would even go that far, that the library should not even define the log level. It up to the user of the lib to define it. I.e. import logging
from typing import Final
LOGGER: Final = logging.getLogger("testcontainers")
LOGGER.setLevel(logging.INFO)This would set the log level to all testcontainers logger (i.e. also testcontainers.core.utils). Besides this, there is nothing more to do. Why this is importantI am using testcontainers in pytest plugin, as I need containers to be started before imports are done (legacy code, that setups databases during import...). So being able to simply disable/change the handler all together would be nice. |
Sorry, something went wrong.
|
Agree 💯 here. I'd go so far as to suggest setup_logger be removed from the library. All callers should be replaced with simply logging.getLogger |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
By setting up a handler in the library, the library users do not have a good control on how/where to write the logs. Do not set a handler from the library.