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

chore: replace print statements with logging #422

Conversation

Sync271
Copy link

@Sync271 Sync271 commented Apr 4, 2022

closes #419

chore: replace print with logging for app

chore: replace print with logging for config_manager

chore: replace print with logging for state_manager

chore: replace print with logging for cli_tools

chore: replace print with logging for validation_builder

chore: replace print with logging for test

chore: replace print with logging for clients and combiner

chore: replace print with logging
@renzokuken
Copy link
Collaborator

/gcbrun

@@ -479,9 +480,9 @@ def main():
elif args.command == "configs":
run_validation_configs(args)
elif args.command == "find-tables":
print(find_tables_using_string_matching(args))
logging.info(find_tables_using_string_matching(args))
Copy link
Contributor

Choose a reason for hiding this comment

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

We will need to set level for logging to 'INFO' for it to display the logging.info messages too. The format is to get the timestamps and the logging level along with the messages.
logging.basicConfig(level=logging.INFO, format='%(asctime)s-%(levelname)s: %(message)s')

@nehanene15 - Could you please validate the format.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we could add a variable coming out of a config file to for level in - logging.basicConfig(level=logging.INFO, format='%(asctime)s-%(levelname)s: %(message)s'). This will help us change it to different Level without any code changes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm worried about this change. This is not actually a log, it is the output of the command.

Personally, I use this response to build validations for a whole schema when i know the names will be very similar.

In reality, my usage should be a feature which gets pulled into the validation command. For now, changing this print is actually an API change and we should hold off until the feature for this is built.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense! Will hold on for these!

@@ -181,7 +182,7 @@ def get_all_tables(client, allowed_schemas=None):
try:
tables = list_tables(client, schema_name)
except Exception as e:
print(f"List Tables Error: {schema_name} -> {e}")
logging.exception(f"List Tables Error: {schema_name} -> {e}")
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is this shouldn't be an exception level. We could use warning or info

Copy link
Collaborator

Choose a reason for hiding this comment

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

Warning would make sense to me

@nehanene15
Copy link
Collaborator

@Sync271 Following up on this PR - We'll need to pull the latest code and make the requested code changes to merge this

@Sync271
Copy link
Author

Sync271 commented Jun 30, 2022

@nehanene15 you should probably take this away from me, won't be able to contribute.

@latika-wadhwa latika-wadhwa self-assigned this Jul 15, 2022
@nehanene15
Copy link
Collaborator

This has been merged with PR #543. Thanks!

@nehanene15 nehanene15 closed this Aug 15, 2022
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.

Implement uniform logging
5 participants