diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-10-01 19:22:58 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-10-06 18:18:07 +0200 |
| commit | fc68f5323584c8307872b02a75b76fe671f26cd4 (patch) | |
| tree | d6c892e3118ef55ccfe59752fd5d849c5ec0ab29 | |
| parent | 304420fe97fe0d377e7afcb525fffecc619f7c02 (diff) | |
| download | jasper-client-fc68f5323584c8307872b02a75b76fe671f26cd4.tar.gz jasper-client-fc68f5323584c8307872b02a75b76fe671f26cd4.zip | |
Set loglevel at least to info during diagnose run and add '--diagnose' argument to jasper.py
| -rwxr-xr-x | client/diagnose.py | 8 | ||||
| -rwxr-xr-x | jasper.py | 7 |
2 files changed, 14 insertions, 1 deletions
diff --git a/client/diagnose.py b/client/diagnose.py index 0483c22..acbec5e 100755 --- a/client/diagnose.py +++ b/client/diagnose.py @@ -98,6 +98,11 @@ class DiagnosticRunner(object): self._logger = logging.getLogger(__name__) def run(self): + # Set loglevel of this module least to info + loglvl = self._logger.getEffectiveLevel() + if loglvl == logging.NOTSET or loglvl > logging.INFO: + self._logger.setLevel(logging.INFO) + self._logger.info("Starting jasper diagnostic at %s", time.strftime("%c")) self._logger.info("Git revision: %r", get_git_revision()) @@ -141,5 +146,6 @@ class DiagnosticRunner(object): if __name__ == '__main__': logging.basicConfig(stream=sys.stdout) logger = logging.getLogger() - logger.setLevel(logging.DEBUG if '--debug' in sys.argv else logging.INFO) + if '--debug' in sys.argv: + logger.setLevel(logging.DEBUG) DiagnosticRunner().run() @@ -20,6 +20,8 @@ parser.add_argument('--local', action='store_true', help='Use text input instead of a real microphone') parser.add_argument('--no-network-check', action='store_true', help='Disable the network connection check') +parser.add_argument('--diagnose', action='store_true', + help='Run diagnose and exit') parser.add_argument('--debug', action='store_true', help='Show debug messages') args = parser.parse_args() @@ -135,6 +137,11 @@ if __name__ == "__main__": logger.warning("Network not connected. This may prevent Jasper from " + "running properly.") + if args.diagnose: + diag = diagnose.DiagnosticRunner() + failed_checks = diag.run() + sys.exit(0 if not failed_checks else 1) + try: app = Jasper() except Exception: |
