Dennis Dmitriev | e56c8b9 | 2017-06-16 01:53:16 +0300 | [diff] [blame^] | 1 | import os |
| 2 | import time |
| 3 | import logging.config |
| 4 | |
| 5 | |
| 6 | LOGGER_SETTINGS = { |
| 7 | 'version': 1, |
| 8 | 'disable_existing_loggers': False, |
| 9 | 'loggers': { |
| 10 | 'reclass_tools': { |
| 11 | 'level': 'DEBUG', |
| 12 | 'handlers': ['console_output'], |
| 13 | }, |
| 14 | 'paramiko': {'level': 'WARNING'}, |
| 15 | 'iso8601': {'level': 'WARNING'}, |
| 16 | 'keystoneauth': {'level': 'WARNING'}, |
| 17 | }, |
| 18 | 'handlers': { |
| 19 | 'console_output': { |
| 20 | 'class': 'logging.StreamHandler', |
| 21 | 'level': 'INFO', |
| 22 | 'formatter': 'default', |
| 23 | 'stream': 'ext://sys.stdout', |
| 24 | }, |
| 25 | }, |
| 26 | 'formatters': { |
| 27 | 'default': { |
| 28 | 'format': '%(asctime)s - %(levelname)s - %(filename)s:' |
| 29 | '%(lineno)d -- %(message)s', |
| 30 | 'datefmt': '%Y-%m-%d %H:%M:%S', |
| 31 | }, |
| 32 | }, |
| 33 | } |
| 34 | |
| 35 | logging.config.dictConfig(LOGGER_SETTINGS) |
| 36 | # set logging timezone to GMT |
| 37 | logging.Formatter.converter = time.gmtime |
| 38 | logger = logging.getLogger(__name__) |