Commit
3aa3c6b69359a3f436aa5a5ce5b3f12bce123e88
by pmaier@sysmocom.depySim-shell: set callback function to print formatted warnings
In many sub modules we still use print() to occassionally print status
messages or warnings. This technically does not hurt, but it is an unclean
solution which we should replace with something more mature.
The python provided warnings module provides a warn() function that can
be used to send warnings to higher layers. The higher layers can receive
the warnings via a callback and then decide what to do with it. In our
application we will format and print the warnings using the cmd2 provided
functions (or print in case the cmd2 object does not exist yet.)
Let's also add a custom warning class "Info", which we can use to print
informative messages
To illustrate how the approach can be used in sub-modules, this also
replaces the print() calls in runtimpe.py with warn() calls.
Related: OS#6864
Change-Id: I187f117e7e1ccdb2a85dfdfb18e84bd7561704eb