changeset 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
files eosd
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/eosd
+++ b/eosd
@@ -65,7 +65,8 @@ class EoSDGameBossRush(EoSDGame):
 
 def main(path, data, stage_num, rank, character, replay, save_filename,
          skip_replay, boss_rush, fps_limit, single_buffer, debug,
-         fixed_pipeline, display_background, display_particles, hints):
+         fixed_pipeline, display_background, display_particles, hints,
+         verbosity):
 
     resource_loader = Loader(path)
 
@@ -84,9 +85,13 @@ def main(path, data, stage_num, rank, ch
         continues = 0
 
     if debug:
-        logging.basicConfig(level=logging.DEBUG)
+        if not verbosity:
+            verbosity = 'DEBUG'
         continues = float('inf')
 
+    if verbosity:
+        logging.basicConfig(level=logging.__getattribute__(verbosity))
+
     if replay:
         with open(replay, 'rb') as file:
             replay = T6RP.read(file)
@@ -215,10 +220,11 @@ parser.add_argument('--fixed-pipeline', 
 parser.add_argument('--no-background', action='store_false', help='Disable background display (huge performance boost on slow systems).')
 parser.add_argument('--no-particles', action='store_false', help='Disable particles handling (huge performance boost on slow systems).')
 parser.add_argument('--hints', metavar='HINTS', default=None, help='Hints file, to display text while playing.')
+parser.add_argument('--verbosity', metavar='VERBOSITY', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], help='Select the wanted logging level.')
 
 args = parser.parse_args()
 
 main(args.path, tuple(args.data), args.stage, args.rank, args.character,
      args.replay, args.save_replay, args.skip_replay, args.boss_rush,
      args.fps_limit, args.single_buffer, args.debug, args.fixed_pipeline,
-     args.no_background, args.no_particles, args.hints)
+     args.no_background, args.no_particles, args.hints, args.verbosity)