intercreate / smpmgr

Simple Management Protocol (SMP) Manager for remotely managing MCU firmware
Apache License 2.0
10 stars 3 forks source link

Feature/logging #4

Closed JPHutchins closed 10 months ago

JPHutchins commented 10 months ago

This PR adds logging that can be set by --loglevel <level> and --logfile <file>. If --logfile is omitted, then no log file is created.

smpmgr --help

 Usage: smpmgr [OPTIONS] COMMAND [ARGS]...                                                                            

╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --port                      TEXT                                        The serial port to connect to, e.g. COM1,  │
│                                                                         /dev/ttyACM0, etc.                         │
│                                                                         [default: None]                            │
│ --timeout                   FLOAT                                       Transport timeout in seconds; how long to  │
│                                                                         wait for requests                          │
│                                                                         [default: 2.0]                             │
│ --loglevel                  [CRITICAL|ERROR|WARNING|INFO|DEBUG|NOTSET]  Debug log level [default: WARNING]         │
│ --logfile                   PATH                                        Log file path [default: None]              │
│ --install-completion                                                    Install completion for the current shell.  │
│ --show-completion                                                       Show completion for the current shell, to  │
│                                                                         copy it or customize the installation.     │
│ --help                                                                  Show this message and exit.                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ image         The SMP Image Management Group.                                                                      │
│ os            The SMP OS Management Group.                                                                         │
│ upgrade       Upload a FW image, mark it for next boot, and reset the device.                                      │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯