-
Notifications
You must be signed in to change notification settings - Fork 104
Backports/1.4/add logs to mavlink server #3467
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
Backports/1.4/add logs to mavlink server #3467
Conversation
….log_path for MAVLinkServer
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR backports logging support to the MAVLink server by adding a configurable log_path attribute, assigning a default directory, and including it as a --log-path flag in the server command. Class diagram for updated MAVLinkServer logging supportclassDiagram
class MAVLinkServer {
+Optional[str] log_path
+__init__()
+_get_version() Optional[str]
+command() str
+name() str
}
MAVLinkServer --|> AbstractRouter
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @joaoantoniocardoso - I've reviewed your changes - here's some feedback:
- Consider moving the default log_path initialization into init (or accepting it as a constructor parameter) so you avoid the lazy check inside convert_endpoint.
- Rather than hardcoding "/var/logs/blueos/services/mavlink-server/", make the log directory configurable via a setting or environment variable to improve flexibility.
- Add a check to create or validate the log_path directory before launching the server to prevent runtime failures if the path doesn’t exist.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider moving the default log_path initialization into __init__ (or accepting it as a constructor parameter) so you avoid the lazy check inside convert_endpoint.
- Rather than hardcoding "/var/logs/blueos/services/mavlink-server/", make the log directory configurable via a setting or environment variable to improve flexibility.
- Add a check to create or validate the log_path directory before launching the server to prevent runtime failures if the path doesn’t exist.
## Individual Comments
### Comment 1
<location> `core/services/ardupilot_manager/mavlink_proxy/MAVLinkServer.py:44` </location>
<code_context>
endpoints = " ".join([convert_endpoint(endpoint) for endpoint in [master_endpoint, *filtered_endpoints]])
- return f"{self.binary()} {endpoints}"
+ if not self.log_path:
+ self.log_path = "/var/logs/blueos/services/mavlink-server/"
+
+ return f"{self.binary()} {endpoints} --log-path={self.log_path}"
</code_context>
<issue_to_address>
Using a mutable default path assignment in get_command() may cause issues if log_path is intentionally set to an empty string.
Checking 'if not self.log_path' will override valid empty string values. Use 'if self.log_path is None' to distinguish between unset and intentionally empty log_path.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
if not self.log_path: | ||
self.log_path = "/var/logs/blueos/services/mavlink-server/" |
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.
issue (bug_risk): Using a mutable default path assignment in get_command() may cause issues if log_path is intentionally set to an empty string.
Checking 'if not self.log_path' will override valid empty string values. Use 'if self.log_path is None' to distinguish between unset and intentionally empty log_path.
This is a backport of #3340 and #3342 into 1.4
Summary by Sourcery
New Features: