Mercurial > touhou
changeset 566:04ae31809dc7
Move all logging logic to the root logger, we don’t need specific handlers anymore.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 30 Jun 2014 20:37:52 +0200 |
parents | 5f7f859a72f9 |
children | b2269b9c6119 |
files | pytouhou/utils/helpers.py scripts/pytouhou |
diffstat | 2 files changed, 9 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/utils/helpers.py +++ b/pytouhou/utils/helpers.py @@ -12,18 +12,8 @@ ## GNU General Public License for more details. ## - -from logging import StreamHandler, Formatter, getLogger - - -def get_logger(name): - handler = StreamHandler() - formatter = Formatter(fmt='[%(name)s] [%(levelname)s]: %(message)s') - handler.setFormatter(formatter) - logger = getLogger(name) - logger.addHandler(handler) - logger.propagate = False - return logger +#TODO: remove that someday. +from logging import getLogger as get_logger def read_string(file, size, encoding=None):
--- a/scripts/pytouhou +++ b/scripts/pytouhou @@ -25,14 +25,14 @@ defaults = {'data': default_data} from pytouhou.options import parse_arguments args = parse_arguments(defaults) -import sys -import logging -from pytouhou.utils.helpers import get_logger +verbosity = args.verbosity or 'WARNING' -if args.verbosity is not None: - logging.basicConfig(level=getattr(logging, args.verbosity)) -logger = get_logger('pytouhou') +import logging +logging.basicConfig(level=getattr(logging, verbosity), + format='[%(name)s] [%(levelname)s]: %(message)s') +logger = logging +logger.root.name = 'pytouhou' if args.game == 'EoSD': from pytouhou.games.eosd import EoSDCommon as Common, EoSDGame as Game @@ -124,6 +124,7 @@ def main(window, path, data, stage_num, resource_loader.scan_archives(data) except IOError: show_simple_message_box(u'Some data files were not found, did you forget the -p option?') + import sys sys.exit(1) if stage_num is None: