datacontract-cli currently uses root logging functions such as:
logging.info(message)
logging.warning(message)
logging.error(message)
This makes it difficult for applications embedding datacontract-cli to configure its logs independently from application logs.
Would you consider using module-level named loggers throughout the package?
logger = logging.getLogger(__name__)
For example:
logger.info(message)
logger.warning(message)
logger.error(message)
This would create loggers under the shared datacontract namespace, such as datacontract.model.run, allowing consumers to configure the whole library:
logging.getLogger("datacontract").setLevel(logging.CRITICAL)
or configure individual modules separately.
Keeping the default propagate=True should preserve the current behavior for users relying on root handlers while providing applications with finer logging control.
I’d be happy to submit a pull request replacing the root logging calls with module-level named loggers if this approach is acceptable
datacontract-cli currently uses root logging functions such as:
This makes it difficult for applications embedding datacontract-cli to configure its logs independently from application logs.
Would you consider using module-level named loggers throughout the package?
For example:
This would create loggers under the shared
datacontractnamespace, such asdatacontract.model.run, allowing consumers to configure the whole library:or configure individual modules separately.
Keeping the default
propagate=Trueshould preserve the current behavior for users relying on root handlers while providing applications with finer logging control.I’d be happy to submit a pull request replacing the root logging calls with module-level named loggers if this approach is acceptable