Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

add --set-master-logger-level option for 'rosmaster' to output LOG_API#1180

Merged
dirk-thomas merged 10 commits intoros:lunar-develfrom
k-okada:add_debug_log_api_roscore
Oct 17, 2017
Merged

add --set-master-logger-level option for 'rosmaster' to output LOG_API#1180
dirk-thomas merged 10 commits intoros:lunar-develfrom
k-okada:add_debug_log_api_roscore

Conversation

@k-okada
Copy link
Copy Markdown
Contributor

@k-okada k-okada commented Oct 6, 2017

extended version of #1173

$ roscore --master-logger-level debug
$ tail -f ${HOME}/.ros/log/latest/master.log 

will output LOG_API messages

parser.add_option("-t", "--timeout",
dest="timeout",
help="override the socket connection timeout (in seconds).", metavar="TIMEOUT")
parser.add_option("--set-master-logger-level",
Copy link
Copy Markdown
Member

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?


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():
Copy link
Copy Markdown
Member

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?

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}
Copy link
Copy Markdown
Member

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))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: unkonwn

@k-okada
Copy link
Copy Markdown
Contributor Author

k-okada commented Oct 7, 2017

@dirk-thomas , thanks for comments. updated PR.

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)]
Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

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

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after comma.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in new commit

@dirk-thomas
Copy link
Copy Markdown
Member

Thank you very much for the patch and iterating on it.

@dirk-thomas dirk-thomas merged commit cd7efd4 into ros:lunar-devel Oct 17, 2017
@k-okada k-okada deleted the add_debug_log_api_roscore branch January 21, 2018 07:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants