Attention is currently required from: fixeria.

dexter uploaded patch set #2 to this change.

View Change

The following approvals got outdated and were removed: Verified-1 by Jenkins Builder

pySim-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
---
M pySim-shell.py
M pySim/runtime.py
A pySim/warnings.py
M tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok
4 files changed, 56 insertions(+), 14 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/29/41229/2

To view, visit change 41229. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I187f117e7e1ccdb2a85dfdfb18e84bd7561704eb
Gerrit-Change-Number: 41229
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy@sysmocom.de>