diff options
Diffstat (limited to 'voctocore')
-rw-r--r-- | voctocore/lib/args.py | 2 | ||||
-rw-r--r-- | voctocore/lib/avrawoutput.py | 3 | ||||
-rw-r--r-- | voctocore/lib/avsource.py | 9 | ||||
-rwxr-xr-x | voctocore/voctocore.py | 16 |
4 files changed, 21 insertions, 9 deletions
diff --git a/voctocore/lib/args.py b/voctocore/lib/args.py index 3f1f3df..1e416f8 100644 --- a/voctocore/lib/args.py +++ b/voctocore/lib/args.py @@ -3,7 +3,7 @@ import argparse __all__ = ['Args'] parser = argparse.ArgumentParser(description='Voctocore') -parser.add_argument('-v', '--verbose', action='store_true', +parser.add_argument('-v', '--verbose', action='count', help="Also print INFO and DEBUG messages.") parser.add_argument('-c', '--color', action='store', choices=['auto', 'always', 'never'], default='auto', diff --git a/voctocore/lib/avrawoutput.py b/voctocore/lib/avrawoutput.py index fd16e58..630c2ca 100644 --- a/voctocore/lib/avrawoutput.py +++ b/voctocore/lib/avrawoutput.py @@ -71,7 +71,8 @@ class AVRawOutput(object): self.log.debug('fd %u removed from multifdsink', fileno) self.currentConnections.remove(conn) - self.log.info('Disconnected Receiver %s, now %u Receiver connected', addr, len(self.currentConnections)) + self.log.info('Disconnected Receiver %s', addr) + self.log.info('Now %u Receiver connected', len(self.currentConnections)) self.log.debug('Adding fd %u to multifdsink', conn.fileno()) fdsink = self.receiverPipeline.get_by_name('fd') diff --git a/voctocore/lib/avsource.py b/voctocore/lib/avsource.py index ff36470..49b39a8 100644 --- a/voctocore/lib/avsource.py +++ b/voctocore/lib/avsource.py @@ -81,19 +81,20 @@ class AVSource(object): return True def on_eos(self, bus, message): - self.log.info('Received End-of-Stream-Signal on Source-Pipeline') + self.log.debug('Received End-of-Stream-Signal on Source-Pipeline') if self.currentConnection is not None: self.disconnect() def on_error(self, bus, message): - self.log.info('Received Error-Signal on Source-Pipeline') - (code, debug) = message.parse_error() - self.log.debug('Error-Details: #%u: %s', code, debug) + self.log.debug('Received Error-Signal on Source-Pipeline') + (error, debug) = message.parse_error() + self.log.debug('Error-Details: #%u: %s', error.code, debug) if self.currentConnection is not None: self.disconnect() def disconnect(self): + self.log.info('Connection closed') self.receiverPipeline.set_state(Gst.State.NULL) self.receiverPipeline = None self.currentConnection = None diff --git a/voctocore/voctocore.py b/voctocore/voctocore.py index 221291c..2f60f72 100755 --- a/voctocore/voctocore.py +++ b/voctocore/voctocore.py @@ -59,9 +59,19 @@ def main(): # configure logging docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty()) - logging.basicConfig( - level=logging.DEBUG if Args.verbose else logging.WARNING, - format='\x1b[33m%(levelname)8s\x1b[0m \x1b[32m%(name)s\x1b[0m: %(message)s' if docolor else '%(levelname)8s %(name)s: %(message)s') + if Args.verbose == 2: + level = logging.DEBUG + elif Args.verbose == 1: + level = logging.INFO + else: + level = logging.WARNING + + if docolor: + format = '\x1b[33m%(levelname)8s\x1b[0m \x1b[32m%(name)s\x1b[0m: %(message)s' + else: + format = '%(levelname)8s %(name)s: %(message)s' + + logging.basicConfig(level=level, format=format) # make killable by ctrl-c logging.debug('setting SIGINT handler') |