:depth: 3
:local:
+
+[0.5.0] - 3/18/2020
+-------------------
+::
+
+ * All xapps (via the base class) now have a logger attribute that can be invoked to provide mdc logging. It is a passthrough to the RIC mdc logger for python (untouched, no value in an API on top at the current time).
+
+
[0.4.1] - 3/17/2020
-------------------
::
RUN apk update && apk add gcc musl-dev bash
# Install
-RUN pip install ricxappframe==0.4.0
+RUN pip install ricxappframe==0.5.0
COPY ping_xapp.py .
# Run
RUN apk update && apk add gcc musl-dev bash
# Install
-RUN pip install ricxappframe==0.4.0
+RUN pip install ricxappframe==0.5.0
COPY pong_xapp.py .
# Run
# store it in SDL and read it back; delete and read
self.sdl_set(my_ns, "numba", number)
- print((self.sdl_get(my_ns, "numba"), self.sdl_find_and_get(my_ns, "num")))
+ self.logger.info(self.sdl_get(my_ns, "numba"))
+ self.logger.info(self.sdl_find_and_get(my_ns, "num"))
self.sdl_delete(my_ns, "numba")
- print(self.sdl_get(my_ns, "numba"))
+ self.logger.info(self.sdl_get(my_ns, "numba"))
# rmr receive
for (summary, sbuf) in self.rmr_get_messages():
+ # summary is a dict that contains bytes so we can't use json.dumps on it so we have no good way to turn this into a string to use the logger unfortunately
+ # print is more "verbose" than the ric logger
+ # if you try to log this you will get: TypeError: Object of type bytes is not JSON serializable
print(summary)
self.rmr_free(sbuf)
def sixtyh(self, summary, sbuf):
"""callback for 60000"""
- print("registered 60000 handler called!")
+ self.logger.info("registered 60000 handler called!")
+ # see comment in ping about this; bytes does not work with the ric mdc logger currently
print(summary)
jpay = json.loads(summary["payload"])
self.rmr_rts(sbuf, new_payload=json.dumps({"ACK": jpay["test_send"]}).encode(), new_mtype=60001, retries=100)
def defh(self, summary, sbuf):
"""default callback"""
- print("default handler called!")
+ self.logger.info("default handler called!")
print(summary)
self.rmr_free(sbuf)
from mdclogpy import Logger
-mdc_logger = Logger(name=__name__)
-
-
# Private base class; not for direct client use
runs this user provided function after the base xapp is initialized
it's signature should be post_init(self)
"""
+ # PUBLIC, can be used by xapps using self.(name):
+ self.logger = Logger(name=__name__)
# Start rmr rcv thread
self._rmr_loop = xapp_rmr.RmrLoop(port=rmr_port, wait_for_ready=rmr_wait_for_ready)
stops the rmr xapp completely.
"""
super().stop()
- mdc_logger.debug("Stopping queue reading thread..")
+ self.logger.debug("Stopping queue reading thread..")
self._keep_going = False
setup(
name="ricxappframe",
- version="0.4.1",
+ version="0.5.0",
packages=find_packages(exclude=["tests.*", "tests"]),
author="Tommy Carpenter",
description="Xapp framework for python",
global rmr_xapp
def post_init(self):
- print("hey")
+ self.logger.info("suppp info")
+ self.logger.debug("suppp debug")
def default_handler(self, summary, sbuf):
nonlocal def_called