Browse Source

Refatora logging config para verbose opt do dev

pull/3453/head
Leandro Roberto 3 years ago
parent
commit
fd93ab6cd4
  1. 21
      sapl/settings.py

21
sapl/settings.py

@ -320,10 +320,20 @@ FORM_RENDERER = 'django.forms.renderers.DjangoTemplates'
# suprime texto de ajuda default do django-filter # suprime texto de ajuda default do django-filter
FILTERS_HELP_TEXT_FILTER = False FILTERS_HELP_TEXT_FILTER = False
LOGGING_CONSOLE_VERBOSE = config('LOGGING_CONSOLE_VERBOSE', cast=bool, default=False)
LOGGING = { LOGGING = {
'version': 1, 'version': 1,
'disable_existing_loggers': False, 'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
},
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
},
},
'formatters': { 'formatters': {
'verbose': { 'verbose': {
'format': '%(levelname)s %(asctime)s ' + host + ' %(pathname)s %(name)s:%(funcName)s:%(lineno)d %(message)s' 'format': '%(levelname)s %(asctime)s ' + host + ' %(pathname)s %(name)s:%(funcName)s:%(lineno)d %(message)s'
@ -336,8 +346,15 @@ LOGGING = {
'console': { 'console': {
'level': 'INFO', 'level': 'INFO',
'class': 'logging.StreamHandler', 'class': 'logging.StreamHandler',
'filters': ['require_debug_true'],
'formatter': 'simple', 'formatter': 'simple',
}, },
'console_verbose': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'filters': ['require_debug_true'],
'formatter': 'verbose',
},
'applogfile': { 'applogfile': {
'level': 'INFO', 'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler', 'class': 'logging.handlers.RotatingFileHandler',
@ -349,8 +366,8 @@ LOGGING = {
}, },
'loggers': { 'loggers': {
'sapl': { 'sapl': {
'handlers': ['applogfile'], 'handlers': ['applogfile'] + ['console_verbose'] if LOGGING_CONSOLE_VERBOSE else [],
'level': 'INFO', 'level': 'DEBUG' if LOGGING_CONSOLE_VERBOSE else 'INFO',
'propagate': True, 'propagate': True,
}, },
'django': { 'django': {

Loading…
Cancel
Save