OpenDroneMap-ODM/opendm/log.py

40 wiersze
882 B
Python
Czysty Zwykły widok Historia

2016-03-03 16:31:25 +00:00
import logging
2015-11-17 11:54:56 +00:00
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
2016-03-03 16:31:25 +00:00
# TODO add file handling
logging.addLevelName(logging.INFO, '%s[%s]' % (OKBLUE, logging.getLevelName(logging.INFO)))
logging.addLevelName(logging.WARNING, '%s[%s]' % (WARNING, logging.getLevelName(logging.WARNING)))
logging.addLevelName(logging.ERROR, '%s[%s]' % (FAIL, logging.getLevelName(logging.ERROR)))
logging.addLevelName(logging.DEBUG, '%s[%s]' % (OKGREEN, logging.getLevelName(logging.DEBUG)))
logging.basicConfig(level=logging.DEBUG,
format='%(levelname)-14s %(message)s' + ENDC)
2015-11-17 11:54:56 +00:00
def ODM_INFO(str):
2016-03-03 16:31:25 +00:00
logging.info(str)
2015-11-17 11:54:56 +00:00
def ODM_WARNING(str):
2016-03-03 16:31:25 +00:00
logging.warning(str)
2015-11-17 11:54:56 +00:00
def ODM_ERROR(str):
2016-03-03 16:31:25 +00:00
logging.error(str)
2016-03-03 18:36:04 +00:00
def ODM_EXCEPTION(str):
logging.exception(str)
2015-11-17 11:54:56 +00:00
def ODM_DEBUG(str):
2016-03-03 16:31:25 +00:00
logging.debug(str)