Mercurial > touhou
comparison eosd @ 415:236bc32597f1
Add a --verbosity option, to disable logging for machines with a very slow terminal.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 16 Jul 2013 21:13:56 +0200 |
parents | b0b8825296d0 |
children | e23871eddb7a |
comparison
equal
deleted
inserted
replaced
414:b0b8825296d0 | 415:236bc32597f1 |
---|---|
63 | 63 |
64 | 64 |
65 | 65 |
66 def main(path, data, stage_num, rank, character, replay, save_filename, | 66 def main(path, data, stage_num, rank, character, replay, save_filename, |
67 skip_replay, boss_rush, fps_limit, single_buffer, debug, | 67 skip_replay, boss_rush, fps_limit, single_buffer, debug, |
68 fixed_pipeline, display_background, display_particles, hints): | 68 fixed_pipeline, display_background, display_particles, hints, |
69 verbosity): | |
69 | 70 |
70 resource_loader = Loader(path) | 71 resource_loader = Loader(path) |
71 | 72 |
72 try: | 73 try: |
73 resource_loader.scan_archives(data) | 74 resource_loader.scan_archives(data) |
82 else: | 83 else: |
83 story = False | 84 story = False |
84 continues = 0 | 85 continues = 0 |
85 | 86 |
86 if debug: | 87 if debug: |
87 logging.basicConfig(level=logging.DEBUG) | 88 if not verbosity: |
89 verbosity = 'DEBUG' | |
88 continues = float('inf') | 90 continues = float('inf') |
91 | |
92 if verbosity: | |
93 logging.basicConfig(level=logging.__getattribute__(verbosity)) | |
89 | 94 |
90 if replay: | 95 if replay: |
91 with open(replay, 'rb') as file: | 96 with open(replay, 'rb') as file: |
92 replay = T6RP.read(file) | 97 replay = T6RP.read(file) |
93 rank = replay.rank | 98 rank = replay.rank |
213 parser.add_argument('--debug', action='store_true', help='Set unlimited continues, and perhaps other debug features.') | 218 parser.add_argument('--debug', action='store_true', help='Set unlimited continues, and perhaps other debug features.') |
214 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') | 219 parser.add_argument('--fixed-pipeline', action='store_true', help='Use the fixed pipeline instead of the new programmable one.') |
215 parser.add_argument('--no-background', action='store_false', help='Disable background display (huge performance boost on slow systems).') | 220 parser.add_argument('--no-background', action='store_false', help='Disable background display (huge performance boost on slow systems).') |
216 parser.add_argument('--no-particles', action='store_false', help='Disable particles handling (huge performance boost on slow systems).') | 221 parser.add_argument('--no-particles', action='store_false', help='Disable particles handling (huge performance boost on slow systems).') |
217 parser.add_argument('--hints', metavar='HINTS', default=None, help='Hints file, to display text while playing.') | 222 parser.add_argument('--hints', metavar='HINTS', default=None, help='Hints file, to display text while playing.') |
223 parser.add_argument('--verbosity', metavar='VERBOSITY', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], help='Select the wanted logging level.') | |
218 | 224 |
219 args = parser.parse_args() | 225 args = parser.parse_args() |
220 | 226 |
221 main(args.path, tuple(args.data), args.stage, args.rank, args.character, | 227 main(args.path, tuple(args.data), args.stage, args.rank, args.character, |
222 args.replay, args.save_replay, args.skip_replay, args.boss_rush, | 228 args.replay, args.save_replay, args.skip_replay, args.boss_rush, |
223 args.fps_limit, args.single_buffer, args.debug, args.fixed_pipeline, | 229 args.fps_limit, args.single_buffer, args.debug, args.fixed_pipeline, |
224 args.no_background, args.no_particles, args.hints) | 230 args.no_background, args.no_particles, args.hints, args.verbosity) |