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

Adding logging #391

Merged
merged 14 commits into from
Feb 8, 2023
Merged

Adding logging #391

merged 14 commits into from
Feb 8, 2023

Conversation

mcminis1
Copy link
Contributor

@mcminis1 mcminis1 commented Feb 5, 2023

Copy link
Collaborator

@jerryjliu jerryjliu left a comment

Choose a reason for hiding this comment

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

I think I'm ok with this! could you provide an example of a user being able to easily use the logger for stdout? I want to make sure that it's still easy to use in a Jupyter notebook setting.

also, are you planning to land multiple PR's?

requirements.txt Outdated Show resolved Hide resolved
@mcminis1

This comment was marked as outdated.

@mcminis1
Copy link
Contributor Author

mcminis1 commented Feb 6, 2023

@jerryjliu I updated a notebook, examples/vector_indices/SimpleIndexDemo.ipynb, with an example. Let me know what you think.

I also added a line in the docs quickstart, and updated the rest of the notebooks.

@mcminis1 mcminis1 marked this pull request as ready for review February 6, 2023 17:37
@mcminis1 mcminis1 requested a review from jerryjliu February 6, 2023 17:37
@mcminis1 mcminis1 changed the title [WIP] Adding logging Adding logging Feb 6, 2023
@jerryjliu
Copy link
Collaborator

thanks @mcminis1!

just a heads up that i do want to spend some time going through this PR to make sure that the user flows all make sense. i'll have some time to get to this later this week. apologies for the delay in advance, just wanted to let you know!

@mcminis1
Copy link
Contributor Author

mcminis1 commented Feb 7, 2023

@jerryjliu sure. I like logging for production use cases. For the notebook, I agree, it feels a little weird. I think they two of us have slightly different perspectives on library design. I'm probably more concerned about use in an application and you're more interested in use in a notebook.

Usually objects have string methods def __repr__(self) -> str: so that, in a notebook, if the object is the last thing in the cell it returns a string. The ntermediate progress isn't output, but the final thing is. If you want something as an intermediate output, then you would structure the object in such as way that you could get it. For instance, consider how requests has a prepare method. Using that you can see all of the intermediate parts before executing the call.

So, after you think on it let me know what you want to do. Perhaps a good middle ground is leaving all the verbose stuff in the code and just adding in the logging as it is here. then the notebook experience is identical, but you can still get good logs.

@jerryjliu
Copy link
Collaborator

jerryjliu commented Feb 7, 2023

@jerryjliu sure. I like logging for production use cases. For the notebook, I agree, it feels a little weird. I think they two of us have slightly different perspectives on library design. I'm probably more concerned about use in an application and you're more interested in use in a notebook.

Usually objects have string methods def __repr__(self) -> str: so that, in a notebook, if the object is the last thing in the cell it returns a string. The ntermediate progress isn't output, but the final thing is. If you want something as an intermediate output, then you would structure the object in such as way that you could get it. For instance, consider how requests has a prepare method. Using that you can see all of the intermediate parts before executing the call.

So, after you think on it let me know what you want to do. Perhaps a good middle ground is leaving all the verbose stuff in the code and just adding in the logging as it is here. then the notebook experience is identical, but you can still get good logs.

Yeah I don't disagree. I do want to make this good for application use - mostly just trying to think about how to also keep the notebook experience somewhat seamless. I will have some thoughts today or tomorrow!

@jerryjliu
Copy link
Collaborator

I just played around with it - actually I like this! I'm going to take a deeper look tonight. Thanks for putting together this PR @mcminis1, this is going to be super valuable

Copy link
Collaborator

@jerryjliu jerryjliu left a comment

Choose a reason for hiding this comment

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

heads up: i'm pushing some changes to fix linting. afterwards i'm down to land!

one followup after this, is that some logging uses the root logger whereas others uses the module logger. we should refactor to be consistent (and use module logger everywhere probably).

@jerryjliu jerryjliu merged commit aa0092a into run-llama:main Feb 8, 2023
@jerryjliu
Copy link
Collaborator

congrats!

what's your twitter? happy to give you a shoutout on the release tomorrow

@mcminis1
Copy link
Contributor Author

mcminis1 commented Feb 8, 2023

https://twitter.com/JeremyMcminis

thanks!

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.

2 participants