Beautify logging code and output #17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "jan/feature/20260617-beautify-logging-code-and-output"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The biggest change this pull request introduces is integrating jw-python's log module, which makes for much nicer logging. The PR also adds some smaller fixes and enhancements in logging-related code.
lib.Types.LoadTypes: Beautify logging code
Shorten redundant occurences of .format(mod_name, member_name).
lib.Types.LoadTypes: Loosen type_filter type
In LoadTypes' constructor, allow the type_filter parameter to be of type Sequence[type[Any]] instead of list[type[T]]. a) Sequence is more generic than list, and b) with T instead of Any, trying to instantiate with an abstract class has mypy complain:
Note that this makes mypy complain that it needs an annotation at the places where LoadTypes is used.
log: Use jw-python's log implementation
Use the (mostly) call-compatible log implementation from jw-python. This buys us much nicer logs with color and source-code positon annotations.
lib.Result: Fill "cmd" ctor parameter
Commands executed by ExecContext and its derived classes don't populate the "cmd" parameter of "Result"'s constructor. Fixing that makes for nicer error messages.
lib.App.run(): Use pretty_cmd() for logging command line
The command line jw-pkg.py is run with is logged with level "debug", and reconstructed with ' '.join(sys.argv). Use pretty_cmd() instead, this adds quotes around spaces.