pedal-edu / pedal

A collection of tools to analyze student's Python source code
https://pedal-edu.github.io/pedal/
MIT License
29 stars 7 forks source link

Full Proper Logging #105

Open acbart opened 1 year ago

acbart commented 1 year ago

I've been ignoring logging for a while, but it's time to do it better. Currently, the best we really get with logging is the following core feedback functions:

The resolver currently handles the SYSTEM category by just collecting all of them that are not suppressed and putting them into the FinalFeedback.systems list. I don't think even BlockPy does anything with that data, but certainly none of the resolvers dump the info to my knowledge.

It seems clear to me that we should use the logging builtin library. There's plenty of debug and info stuff to log for each tool. Plenty of warnings and errors I'm sure too. This provides a fairly convenient mechanism to standardize on.

Here are our major use cases:

However, I think one thing to do is to provide a FeedbackHandler (or ReportHandler?) that would easily let someone log things directly to the feedback channels as regular feedback. However, I wouldn't expect people to really want this to be turned on, unless they were quickly trying to debug something through the feedback channel. Instead, they'd want to use whatever the environment's more sophisticated logging handlers would be.

acbart commented 1 year ago

This dovetails with error handling. What kind of errors do we have in Pedal?

The latter two kinds of errors should be raised, that seems clear enough. And I guess logged? Or one of the other? I need to think a bit more about what this should look like exactly. Can we think of some cases of actual errors?

It's confusing because usually catchable exceptions are because you know the user can get things into an invalid state. But what situations in Pedal allow the instructor to get things into a bad state? Let's think about each tool:

So many of Pedal's tools are unconditional executions. You just call them and let them work. That's a tricky part of all this.