Richer configuration of logging module through config{,_local}.py.

This commit is contained in:
Sybren A. Stüvel 2016-05-23 12:05:56 +02:00
parent 06ffffa044
commit a6f7250eb3
2 changed files with 28 additions and 7 deletions

View File

@ -1,4 +1,5 @@
import logging
import logging.config
import os
import tempfile
from bson import ObjectId
@ -103,14 +104,8 @@ os.environ.pop('TMPDIR', None)
# Configure logging
logging.basicConfig(
level=logging.WARNING,
format='%(asctime)-15s %(levelname)8s %(name)s %(message)s')
logging.getLogger('werkzeug').setLevel(logging.INFO)
logging.config.dictConfig(app.config['LOGGING'])
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG if app.config['DEBUG'] else logging.INFO)
if app.config['DEBUG']:
log.info('Pillar starting, debug=%s', app.config['DEBUG'])

View File

@ -70,3 +70,29 @@ FULL_FILE_ACCESS_ROLES = {u'admin', u'subscriber', u'demo'}
# Client and Subclient IDs for Blender ID
BLENDER_ID_CLIENT_ID = 'SPECIAL-SNOWFLAKE-57'
BLENDER_ID_SUBCLIENT_ID = 'PILLAR'
# See https://docs.python.org/2/library/logging.config.html#configuration-dictionary-schema
LOGGING = {
'version': 1,
'formatters': {
'default': {'format': '%(asctime)-15s %(levelname)8s %(name)s %(message)s'}
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
'stream': 'ext://sys.stderr',
}
},
'loggers': {
'application': {'level': 'INFO'},
'werkzeug': {'level': 'INFO'},
},
'root': {
'level': 'WARNING',
'handlers': [
'console',
],
}
}