import logging.config
from . import LOGSTASH_ADDRESS

def basic(_):
    """
    Logs to the console always, and to LOGSTASH_ADDRESS when DEBUG is off. Overrides
    Django's logging.

    To use, add to your settings file:
    LOGGING_CONFIG = 'arcutils.logging.basic'

    We ignore the configuration that is passed in, hence the _ as the first
    argument
    """
    logging.config.dictConfig({
        'version': 1,
        'disable_existing_loggers': True,
        'filters': {
            'require_debug_false': {
                '()': 'django.utils.log.RequireDebugFalse',
            },
            'require_debug_true': {
                '()': 'django.utils.log.RequireDebugTrue',
            },
        },
        'handlers': {
            'logstash': {
                'level': 'DEBUG',
                'class': 'logstash.TCPLogstashHandler',
                'host': LOGSTASH_ADDRESS.rsplit(":", 1)[0],
                'port': int(LOGSTASH_ADDRESS.rsplit(":", 1)[1]),
                'version': 1,
                'message_type': 'django',
                'filters': ['require_debug_false'],
            },
            'console': {
                'level': 'DEBUG',
                'class': 'logging.StreamHandler',
            },
        },
        'loggers': {
            # we need to explicitly override the django logger so it propagates
            # to the root logger
            'django': {
                'propagate': True,
            }
        },
        'root': {
            'handlers': ['logstash', 'console'],
            'level': 'DEBUG',
        },
    })

@@ -448,32 +448,184 @@
 loggers': True,%0A
+        'formatters': %7B%0A            'verbose': %7B%0A                'format': '%25(levelname)s %25(pathname)s:%25(lineno)d %25(message)s'%0A            %7D%0A        %7D,%0A
         'filters
@@ -928,37 +928,36 @@
       'level': '
-DEBUG
+INFO
 ',%0A             
@@ -1306,37 +1306,36 @@
       'level': '
-DEBUG
+INFO
 ',%0A             
@@ -1375,34 +1375,302 @@
 r',%0A            
+    'formatter': 'verbose'%0A            %7D,%0A            'mail_admins': %7B%0A                'level': 'ERROR',%0A                'filters': %5B'require_debug_false'%5D,%0A                'class': 'django.utils.log.AdminEmailHandler',%0A                'include_html': True%0A            
 %7D
-,
 %0A        %7D,%0A    
@@ -1931,27 +1931,42 @@
 : %5B'
-logstash', 'console
+console', 'mail_admins', 'logstash
 '%5D,%0A
@@ -1987,21 +1987,20 @@
 evel': '
-DEBUG
+INFO
 ',%0A     

Set default level to INFO. Add mail_admins for errors