Skip to content

Commit

Permalink
Allow optional argument on set-logger-level for backward compability
Browse files Browse the repository at this point in the history
  • Loading branch information
Affonso-Gui committed Aug 11, 2022
1 parent 9181578 commit 60b6ceb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions roseus/roseus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1786,8 +1786,11 @@ pointer ROSEUS_GETNAMESPACE(register context *ctx,int n,pointer *argv)

pointer ROSEUS_SET_LOGGER_LEVEL(register context *ctx, int n, pointer *argv)
{
ckarg(1);
int log_level = intval(argv[0]);
ckarg2(1,2);
int log_level;
if (n==1) log_level = intval(argv[0]);
else log_level = intval(argv[1]);

ros::console::levels::Level level = ros::console::levels::Debug;
switch(log_level){
case 1:
Expand All @@ -1811,6 +1814,7 @@ pointer ROSEUS_SET_LOGGER_LEVEL(register context *ctx, int n, pointer *argv)

// roseus currently does not support multiple loggers
// which must be outputted using the 'ROS_DEBUG_NAMED'-like macros
// set all logging to the ROSCONSOLE_DEFAULT_NAME, independent of the argument
bool success = ::ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, level);
if (success)
{
Expand Down

0 comments on commit 60b6ceb

Please sign in to comment.