-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update to user logger #250
base: master
Are you sure you want to change the base?
Conversation
utility/check_ant.py
Outdated
@@ -87,44 +87,44 @@ def check_receivers(): | |||
raise RuntimeError("AP e_stop: %s" % ant.sensor.ap_e_stop_reason.get_value()) | |||
|
|||
# Verify that all the config data has been added from RTS | |||
print("\nBeginning a quick check of antenna %s" % ant.name) | |||
print("\nAP version: %s" % ant.sensor.ap_api_version.get_value()) | |||
user_logger.info("\nBeginning a quick check of antenna %s" % ant.name) |
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.
You do not need the end of line marker "\n" in the log message
utility/check_ant.py
Outdated
|
||
print("\nChecking Receiver") | ||
user_logger.info("\nChecking Receiver") |
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.
You do not need the end of line marker "\n" in the log message
utility/check_ant.py
Outdated
check_receivers() | ||
|
||
print("\nChecking Digitisers") | ||
user_logger.info("\nChecking Digitisers") |
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.
You do not need the end of line marker "\n" in the log message
utility/check_ant.py
Outdated
|
||
print("\nChecking brakes") | ||
user_logger.info("\nChecking brakes") |
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.
You do not need the end of line marker "\n" in the log message
utility/check_ant.py
Outdated
|
||
print("\nChecking doors") | ||
user_logger.info("\nChecking doors") |
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.
You do not need the end of line marker "\n" in the log message
utility/check_ant.py
Outdated
|
||
|
||
if any_errors: | ||
print('\n') | ||
user_logger.info('\n') |
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.
This is not needed in the log file
utility/global_sync.py
Outdated
user_logger.info(kat.controlled_objects) | ||
user_logger.info(kat.ants.clients) | ||
user_logger.info(opts) | ||
user_logger.info("_______________________") |
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 objects should be formatted into strings to prevent unexpected surprises
utility/global_sync.py
Outdated
response = ant.req.deactivate() | ||
print(ant.req.dig_capture_list()) | ||
print('\n') | ||
print("Script complete") | ||
user_logger.info('\n') |
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.
This is not needed in the log
utility/lubricate_vacuum_pump.py
Outdated
print opts | ||
print "_______________________" | ||
user_logger.info("_______________________") | ||
user_logger.info(opt) |
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 objects should be formatted into strings to prevent unexpected surprises
Changes made as per request from @spassmoor |
Any other comments/concerns? |
|
||
elif ant.sensors.rsc_rxl_rfe1_temperature.get_value() > 30 and ant.sensors.rsc_rxl_rfe1_temperature.get_value() < 100: | ||
user_logger.warning("L-band rfe1 temperature is warm @ %.2f. alert the site technician" % (ant.sensors.rsc_rxl_rfe1_temperature.get_value())) | ||
else: | ||
user_logger.warning("L-band rfe1 temperature is warm. alert the site technician") | ||
|
||
indexer_angle = ant.sensor.ap_indexer_position_raw.get_value() | ||
print("receiver indexer value is %d." % indexer_angle) | ||
user_logger.info("receiver indexer value is %d." % indexer_angle) |
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.
One of the advantages of logging is that string formatting is more compact. You can just write:
user_logger.info("receiver indexer value is %d.", indexer_angle)
This is especially useful when multiple items are formatted, but a good habit nonetheless.
Revisiting the past? :-) My only comment still stands... I would change the formatting to use the logger friendly style. There is also a |
Have changed all the print statements to user_logger at the requisite levels in the utilities folder.
@ludwigschwardt
@spassmoor
@rubyvanrooyen
@kbmontshiwa