Skip to content

Remove dependecies from extensions logger helper

Situation

Alliance Auth has a preconfigured logger for community apps called "extensions logger". To use the logger the helper function get_extension_logger() needs to be called to create the logger in the community app.

Problem

This helper function is currently located in allianceauth.services.hooks. In that module it is mixed together with other components, which require Django to be fully up and running to function. This creates an unnecessary dependency and e.g. prevents the extension logger from being used for any code that runs during Django startup.

Since logging is such an essential and important function, those dependencies should be removed, so the extension logger can be used more widely and without unnecessary overhead.

Solution

This change removes that dependency by putting the helper function into it's own module (allianceauth.services.loggers). The external interface - i.e. the get_extension_logger() function- remains available from allianceauth.services.hooks to ensure backwards compatibility.

This change also adds tests for the helper function, which are currently missing.

Merge request reports