rcutils
rcutils copied to clipboard
Add option to set logger severity level using a config file
Add ability to specify the logger severity using a config file similar to ROS1's ROSCONSOLE_CONFIG_FILE
env-variable, this can be done by export RCUTILS_LOGGING_CONFIG_FILE=path_to_config_file
This's a demo:
https://user-images.githubusercontent.com/16278108/134510231-f88ec412-ae1d-44b0-a832-d48c12cfa3f4.mp4
* environment variable prevails logging level arguments? I am not sure which one prevails to the other.
@fujitatomoya is there such a facility to set logging levels through environment variables? I don't think so, in which case this question would be moot for now. (correct me if I'm wrong here please)
is there such a facility to set logging levels through environment variables?
No, i do not think so. not via environmental variable, but we can change it with ros arguments. so i just thought that it should be discussed as design before implementation?
environment variable prevails logging level arguments?
No, logging level arguments prevail the environment variable ones, so if we have logger1 set to debug in the RCUTILS_LOGGING_CONFIG_FILE
and we set it to error in the argument (ros2 run pkg node --ros-args --log-level logger1:=error
) it will be set to error
it should be able to set default level as well in the configuration file?
Done in the latest commit
probably it would be nice to follow up tutorials how to configure logging level via RCUTILS_LOGGING_CONFIG_FILE?
I'm working on it now
I'll add tests for this PR later this week
Please also update the API documentation, describing the new environment variable and the expected file format.
You mean this one, right .?
@JafarAbdi I mean the docblock for the function being modified:
https://github.com/ros2/rcutils/blob/master/include/rcutils/logging.h#L49-L107