Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Update to user logger #250

wants to merge 7 commits into from

Conversation

lmagnus
Copy link
Contributor

@lmagnus lmagnus commented Oct 10, 2017

Have changed all the print statements to user_logger at the requisite levels in the utilities folder.

@ludwigschwardt
@spassmoor
@rubyvanrooyen
@kbmontshiwa

Verified

This commit was signed with the committer’s verified signature.
ExampleWasTaken ExampleWasTaken
@@ -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)
Copy link
Contributor

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


print("\nChecking Receiver")
user_logger.info("\nChecking Receiver")
Copy link
Contributor

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

check_receivers()

print("\nChecking Digitisers")
user_logger.info("\nChecking Digitisers")
Copy link
Contributor

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


print("\nChecking brakes")
user_logger.info("\nChecking brakes")
Copy link
Contributor

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


print("\nChecking doors")
user_logger.info("\nChecking doors")
Copy link
Contributor

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



if any_errors:
print('\n')
user_logger.info('\n')
Copy link
Contributor

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

user_logger.info(kat.controlled_objects)
user_logger.info(kat.ants.clients)
user_logger.info(opts)
user_logger.info("_______________________")
Copy link
Contributor

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

response = ant.req.deactivate()
print(ant.req.dig_capture_list())
print('\n')
print("Script complete")
user_logger.info('\n')
Copy link
Contributor

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

print opts
print "_______________________"
user_logger.info("_______________________")
user_logger.info(opt)
Copy link
Contributor

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

@lmagnus
Copy link
Contributor Author

lmagnus commented Oct 10, 2017

Changes made as per request from @spassmoor

@lmagnus
Copy link
Contributor Author

lmagnus commented Oct 12, 2017

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)
Copy link
Contributor

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.

@ludwigschwardt
Copy link
Contributor

Revisiting the past? :-)

My only comment still stands... I would change the formatting to use the logger friendly style. There is also a .format in there that could be treated similarly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants