# Django
from django.apps import AppConfig
# from django.core import checks
from django.utils.translation import ugettext_lazy as _
from django.utils.log import configure_logging
from django.conf import settings


class ConfConfig(AppConfig):

    name = 'awx.conf'
    verbose_name = _('Configuration')

    def ready(self):
        self.module.autodiscover()
        from .settings import SettingsWrapper
        SettingsWrapper.initialize()
        if settings.LOG_AGGREGATOR_ENABLED:
            LOGGING_DICT = settings.LOGGING
            LOGGING_DICT['handlers']['http_receiver']['class'] = 'awx.main.utils.handlers.HTTPSHandler'
            if 'awx' in settings.LOG_AGGREGATOR_LOGGERS:
                if 'http_receiver' not in LOGGING_DICT['loggers']['awx']['handlers']:
                    LOGGING_DICT['loggers']['awx']['handlers'] += ['http_receiver']
            configure_logging(settings.LOGGING_CONFIG, LOGGING_DICT)
        # checks.register(SettingsWrapper._check_settings)
