Commit 5f841531 authored by Dimitris Lampridis's avatar Dimitris Lampridis

[sw] [tools] add option to enable logging to wrtd-logging

parent 23e22cb8
......@@ -129,11 +129,7 @@ A list of the available options can be retrieved by passing the ``-h`` option to
-D DEV, --dev-id DEV MockTurtle device ID (integer) to open
-c COUNT, --count COUNT
Number of entries to read (0 = infinite)
-e, --enable Enable event logging on the Node if not already
enabled.
Log entries are printed using the format presented in :cpp:func:`wrtd_get_next_event_log_entry`.
.. hint::
Remember to enable logging first, by setting the :c:macro:`WRTD_ATTR_EVENT_LOG_ENABLED`
:ref:`attribute` to ``TRUE``. An easy way to achieve this is to use the ``set-log`` command of
:ref:`wrtd_config`.
......@@ -12,7 +12,7 @@ import argparse
from PyWrtd import *
def signal_handler(sig, frame):
sys.exit(0)
sys.exit(0)
def print_logging(wrtd, count):
n_read = 0
......@@ -31,6 +31,8 @@ def main():
help='MockTurtle device ID (integer) to open')
parser.add_argument('-c', '--count', dest='count', type=int, default=0,
help='Number of entries to read (0 = infinite)')
parser.add_argument('-e', '--enable', action='store_true',
help='Enable event logging on the Node if not already enabled.')
args = parser.parse_args()
......@@ -38,6 +40,11 @@ def main():
wrtd = PyWrtd(dev)
if (args.enable):
wrtd.set_attr_bool(PyWrtd.WRTD_GLOBAL_REP_CAP_ID,
PyWrtd.WRTD_ATTR_EVENT_LOG_ENABLED,
True)
print_logging(wrtd, args.count)
if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment