roboticslab-uc3m / questions-and-answers

A place for general debate and question&answer
https://robots.uc3m.es/developer-manual/appendix/repository-index.html
2 stars 0 forks source link

Using YARP's internal logging instead of color-debug #90

Closed David-Estevez closed 3 years ago

David-Estevez commented 7 years ago

Hi!

I have just discovered that yarp has a logging system for the log messages (info, debug, warning, error...) of their yarp devices. We are using a similar system for our devices, based on color-debug, but I guess their logging system has better integration with yarp devices and other yarp mechanisms. Messages would also look more homogeneous if sent to stdout with the yarp logger instead of our own system.

The question is... should we use yarp's internal logging for our devices? or should we stick to the current color-debug system?

PeterBowman commented 7 years ago

I recall having come across some YARP utilities that understand and handle these logging streams, perhaps yarpdatadumper or yarpdataplayer. We can also mention the yarplogger program, but its documentation is scarce.

A few cons against migrating to YARP's logger:

Edit: regarding integration within YARP utilities, see robotology/QA#206.

jgvictores commented 7 years ago

Behold a screenshot of yarplogger.

yarplogger

David-Estevez commented 7 years ago

It reminds me of Android's Logcat, which is extremely useful for debugging on Android:

image

PeterBowman commented 5 years ago

No colors (obviously).

False, just set the YARP_COLORED_OUTPUT environment variable. See INFO and DEBUG logs below:

Screenshot from 2019-08-01 21-37-34

PeterBowman commented 5 years ago

A few more words about YARP log streams:

I'm a bit concerned about performance and the lack of Windows support (we can take advantage of previous experience on color-debug and submit a patch, though; see https://github.com/roboticslab-uc3m/color-debug/issues/5), but this is really cool. Shall we take this seriously and replace color-debug usage in our repos? Attaching screenshot for science, I made color-debug macros call YARP logger functions for this test:

Screenshot from 2019-08-01 23-06-25

Relevant sources:

PeterBowman commented 4 years ago

YARP's logging system is undergoing a major overhaul. New features include fine-grained component-based tagging, and a lot more information accompanying each log event. See https://github.com/robotology/yarp/pull/2256 and linked dependent tickets. Also, https://github.com/robotology/yarp/pull/2258 contains a nice screenshot of new yarplogger in action.

I'm a bit concerned about performance and the lack of Windows support (we can take advantage of previous experience on color-debug and submit a patch, though; see roboticslab-uc3m/color-debug#5), but this is really cool.

Implemented in YARP 3.3.x, see https://github.com/robotology/yarp/pull/2076.

PeterBowman commented 4 years ago

YARP's logging system is undergoing a major overhaul.

This is nicely documented in http://www.yarp.it/yarp_logging.html (source).

PeterBowman commented 4 years ago

Currently running YARP 3.4 on TEO (https://github.com/roboticslab-uc3m/teo-hardware-issues/issues/58) with the new logging system and fancy colors enabled (https://github.com/roboticslab-uc3m/teo-developer-manual/commit/89c44dcfdc93e13dc49348774be1c48169151927).

Edit: rolled back to YARP 3.3 due to lack of Python 2 support.

PeterBowman commented 4 years ago

In view of the forthcoming replacement of color-debug with YARP logging goodies, I'm transferring this issue to a more horizontally focused location.

PeterBowman commented 4 years ago
Regular output ![Screenshot from 2020-10-11 12-57-10](https://user-images.githubusercontent.com/9977198/95678675-7213c980-0bce-11eb-8b1a-1f51c1e7aff3.png)
Yay, colors ![Screenshot from 2020-10-11 12-56-00](https://user-images.githubusercontent.com/9977198/95678678-750eba00-0bce-11eb-991c-879df6f338fb.png)
Compact output (colored markers as log levels) ![Screenshot from 2020-10-11 12-57-40](https://user-images.githubusercontent.com/9977198/95678679-76d87d80-0bce-11eb-8f89-dd66ceb7437a.png)
Verbose output ![Screenshot from 2020-10-11 13-05-13](https://user-images.githubusercontent.com/9977198/95678682-793ad780-0bce-11eb-9745-f5e11fecae2e.png)
yarplogger GUI ![Screenshot from 2020-10-11 13-33-18](https://user-images.githubusercontent.com/9977198/95678683-7b049b00-0bce-11eb-9f22-517dbadaded9.png)
PeterBowman commented 4 years ago

Further remarks (see https://github.com/roboticslab-uc3m/questions-and-answers/issues/90#issuecomment-517458703):

PeterBowman commented 4 years ago

I have given this a try at https://github.com/roboticslab-uc3m/openrave-yarp-plugins/commit/ea405eb126840438b386fcfbadb50174796f3559 and https://github.com/asrob-uc3m/yarp-devices/commit/c7f717c5b8dc025a383f6123f6aeb7133b0b3f6c. Some things to consider:

PeterBowman commented 4 years ago

Note the --verbose option to yarpdev and several other companion utilities has been superseded by logging components (https://github.com/robotology/yarp/issues/2389#issuecomment-714720180). This may partially affect the solutions adopted in https://github.com/roboticslab-uc3m/questions-and-answers/issues/49. For instance, but not sure if a feature or a bug, now I can see all debug lines related to device configuration when issuing yarpdev --device EmulatedControlboard --name /fake, no YARP_VERBOSE=1 environment variable nor --verbose option involved (the former would additionally bloat the console with lots of comms-related notices). Besides, I need to look into lines such as this: rf.setVerbose(true).

PeterBowman commented 3 years ago

Color-debug is officially dead in most of roboticslab-uc3m (search) and in all asrob-uc3m repos (search). Leftovers:

As soon as YARP 3.5 is released, I'm going to gradually drop support for YARP 3.3 and require 3.4, introducing logging components in our repositories. For now, the component-less scheme I followed mostly everywhere is:

yInfo() << "Bla bla bla" << value << "bla bla bla";
PeterBowman commented 3 years ago

As soon as YARP 3.5 is released, I'm going to gradually drop support for YARP 3.3 and require 3.4, introducing logging components in our repositories.

Done. Component names start with rl and reflect the main class of the library (or the library name itself), device or program, e.g. rl.YarpCloudUtils, rl.KdlSolver, rl.DumpCanBus. Components are declared and defined in their own .hpp/.cpp pair of files, then added to CMakeLists.txt (example). If only used in a single translation unit, they can be placed in an anonymous namespace and defined via YARP_LOG_COMPONENT (example).