Skip to content

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

# 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

user_logger.info("X-band serial number: %s" % ant.sensor.rsc_rxx_serial_number.get_value())

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

user_logger.info(":) AP Servo OK")

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

user_logger.info(":) Brakes released")

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

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?


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.

4 participants