diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-02-07 17:30:21 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-03-02 11:38:50 -0500 |
commit | 5f80c84309f30a6363d1b9cd9999749b57de0ef0 (patch) | |
tree | da84084bb975268d3b4494c19c586a645f67144d /klippy/console.py | |
parent | 3c6eb376ac75b7820810f709f14d5d48257e1d45 (diff) | |
download | kutter-5f80c84309f30a6363d1b9cd9999749b57de0ef0.tar.gz kutter-5f80c84309f30a6363d1b9cd9999749b57de0ef0.tar.xz kutter-5f80c84309f30a6363d1b9cd9999749b57de0ef0.zip |
console: Add option to enable debug output mode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/console.py')
-rwxr-xr-x | klippy/console.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/klippy/console.py b/klippy/console.py index bbf5377d..bacca30d 100755 --- a/klippy/console.py +++ b/klippy/console.py @@ -204,6 +204,8 @@ class KeyboardReader: def main(): usage = "%prog [options] <serialdevice>" opts = optparse.OptionParser(usage) + opts.add_option("-v", action="store_true", dest="verbose", + help="enable debug messages") opts.add_option("-b", "--baud", type="int", dest="baud", help="baud rate") options, args = opts.parse_args() if len(args) != 1: @@ -215,7 +217,11 @@ def main(): or serialport.startswith("/tmp/")): baud = 250000 - logging.basicConfig(level=logging.DEBUG) + debuglevel = logging.INFO + if options.verbose: + debuglevel = logging.DEBUG + logging.basicConfig(level=debuglevel) + r = reactor.Reactor() kbd = KeyboardReader(r, serialport, baud) try: |