Kattis / problemtools

Tools to manage problem packages using the Kattis problem package format.
MIT License
101 stars 70 forks source link

Improved logging, fix unicode error, include_dir buildrun #253

Closed incaseoftrouble closed 4 months ago

incaseoftrouble commented 4 months ago

This replaces #209 (I migrated the repository) and fixes #201

incaseoftrouble commented 4 months ago

Okay, I'm quite happy with this now.

Changes:

simonlindholm commented 3 months ago

Use (named) loggers where applicable, in particular each problem aspect now has their own name

I've found that this makes the output look rather uglier. Where previously I had

$ verifyproblem.sh .
Loading problem myproblemid
Checking config
...
Checking submissions
ERROR in submissions: Require at least one "accepted" submission
   Slowest AC runtime: None, setting timelim to 300 secs, safety margin to 300 secs

I now get

$ verifyproblem.sh .
Loading problem myproblemid
Checking config
...
Checking submissions
[__main__.myproblemid.submission] ERROR: Require at least one
   "accepted" submission
   Slowest AC runtime: None, setting timelim to 300 secs, safety margin to 300 secs

I would prefer to revert the use of []-style log prefixes here, because this is user-facing UI and not logging that needs to be made systematic. But at the very least we should remove the mention of __main__ and avoid 80-col text wrapping.

Tagl commented 3 months ago

I 100% agree with the text wrapping being worse now than previously. I do see great value in categorization of the log messages but I'd also prefer it to not look this way when running verifyproblem in default log level outputting to stdout.

incaseoftrouble commented 3 months ago

[]-style log prefixes ... avoid 80-col text wrapping.

This is due to PlasTeX completely butchering the logging framework in a (near) irreparable way. Which is why I wanted to delay loading it.

I would prefer to revert the use of []-style log prefixes here, because this is user-facing UI and not logging that needs to be made systematic. But at the very least we should remove the mention of main

The correct "fix" for this is to remove eagerly importing plastex and, if needed, define a logging format that is applied in __main__. Then the output will look like before with the added bonus that problemtools' output can be configured when used as a library.

EDIT: I can do that if wanted!