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

add logging info #73

Merged
merged 9 commits into from
Jul 6, 2023
Merged

add logging info #73

merged 9 commits into from
Jul 6, 2023

Conversation

dave-connors-3
Copy link
Collaborator

resolves #68

@nicholasyager tried my hand at using loguru for some basic logging messages here. very open to changing how we structure this and whether we use this package at all -- it's pretty straightforward to use, but I have never added logs to a cli app before, so I don't know what best practices to consider.

2023-06-26 11 03 55

@dave-connors-3 dave-connors-3 marked this pull request as ready for review June 26, 2023 20:39
Copy link
Contributor

@b-per b-per left a comment

Choose a reason for hiding this comment

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

OK as is but I added 1 comment.

try:
meshify_constructor.add_model_contract()
logger.success(f"Successfully added contract to model: {model_unique_id}")
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

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

I am OK with this for now to add debugging but I have 2 comments:

  • what do we want the tool to do when there is an error? stop at the first error or skip the error and continue until the end (which is what we are doing with the try/except)
  • if possible, we should be specific about the exceptions raised so we can add specific logic/logging: Exception as e is the generic one but we could try to be more specific. This is something that can be revisited later.

Copy link
Collaborator

@nicholasyager nicholasyager left a comment

Choose a reason for hiding this comment

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

Two main areas for feedback/discussion include:

  1. CLI UX for setting debug/log-level.
  2. Exceptions being swalloed by the try/except behavior.

Comment on lines +264 to +265
except Exception as e:
logger.error(f"Error adding model version to model yml: {e}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently, this try/except eats the exception. Am I correct in believe that we want to re-raise the exception after logging?

@dave-connors-3
Copy link
Collaborator Author

@nicholasyager @b-per made a couple updates yesterday that I think address the question of try/except -- in the except branch, i now include logger.exception(e), which I still raises the exception, as Nich mentioned in their comment. Let me know if that is not sufficient!

@b-per -- re: more detailed excpetions, i totally agree, but wasn't positive which class was more representative of what the error might be at the level I placed the logs.

@dave-connors-3 dave-connors-3 mentioned this pull request Jul 6, 2023
@dave-connors-3
Copy link
Collaborator Author

@nicholasyager @b-per i am going to merge this as is so I can add logging to PR #63 before I leave to go OOO. I opened #92 to reflect the outstanding discussion points from above!

@dave-connors-3 dave-connors-3 merged commit 912d5ad into main Jul 6, 2023
1 check passed
@nicholasyager nicholasyager deleted the logging branch July 25, 2023 20:35
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.

add structured logs
3 participants