-
Notifications
You must be signed in to change notification settings - Fork 914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --set-master-logger-level option for 'rosmaster' to output LOG_API #1180
add --set-master-logger-level option for 'rosmaster' to output LOG_API #1180
Conversation
tools/roslaunch/scripts/roscore
Outdated
@@ -56,6 +56,9 @@ def _get_optparse(): | |||
parser.add_option("-t", "--timeout", | |||
dest="timeout", | |||
help="override the socket connection timeout (in seconds).", metavar="TIMEOUT") | |||
parser.add_option("--set-master-logger-level", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The set
of the options seems redundant to me. How about just --master-logger-level
?
@@ -108,6 +112,14 @@ def rosmaster_main(argv=sys.argv, stdout=sys.stdout, env=os.environ): | |||
import socket | |||
socket.setdefaulttimeout(float(options.timeout)) | |||
|
|||
if options.master_logger_level: | |||
level = {'debug': logging.DEBUG, 'info': logging.INFO, 'warn': logging.WARN, 'error': logging.ERROR, 'fatal': logging.FATAL} | |||
if options.master_logger_level in level.keys(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we ignore the case and do options.master_logger_level.lower()
here?
@@ -108,6 +112,14 @@ def rosmaster_main(argv=sys.argv, stdout=sys.stdout, env=os.environ): | |||
import socket | |||
socket.setdefaulttimeout(float(options.timeout)) | |||
|
|||
if options.master_logger_level: | |||
level = {'debug': logging.DEBUG, 'info': logging.INFO, 'warn': logging.WARN, 'error': logging.ERROR, 'fatal': logging.FATAL} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the dict contains multiple elements I would suggest naming the variable levels
.
logger.info("set rosmaster.master logger level '{}'".format(options.master_logger_level)) | ||
logging.getLogger("rosmaster.master").setLevel(level[options.master_logger_level]) | ||
else: | ||
logger.error("--set-master-logger-level received unkonwn option '{}'".format(options.master_logger_level)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling: unkonwn
@dirk-thomas , thanks for comments. updated PR. |
# catkin/fuerte: no longer use ROS_ROOT-relative executables, search path instead | ||
master = type_ | ||
# zenmaster is deprecated and aliased to rosmaster | ||
if type_ in [Master.ROSMASTER, Master.ZENMASTER]: | ||
package = 'rosmaster' | ||
args = [master, '--core', '-p', str(port), '-w', str(num_workers)] | ||
args = [master, '--core', '-p', str(port), '-w', str(num_workers), '--master-logger-level', str(master_logger_level)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this potentially pass False
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, will not pass argument when master_logger_level
is False
@@ -152,7 +155,7 @@ def _init_runner(self): | |||
raise RLException("pm is not initialized") | |||
if self.server is None: | |||
raise RLException("server is not initialized") | |||
self.runner = roslaunch.launch.ROSLaunchRunner(self.run_id, self.config, server_uri=self.server.uri, pmon=self.pm, is_core=self.is_core, remote_runner=self.remote_runner, is_rostest=self.is_rostest, num_workers=self.num_workers, timeout=self.timeout) | |||
self.runner = roslaunch.launch.ROSLaunchRunner(self.run_id, self.config, server_uri=self.server.uri, pmon=self.pm, is_core=self.is_core, remote_runner=self.remote_runner, is_rostest=self.is_rostest, num_workers=self.num_workers, timeout=self.timeout,master_logger_level=self.master_logger_level) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after comma.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in new commit
Thank you very much for the patch and iterating on it. |
extended version of #1173
will output LOG_API messages