compas-dev / compas

Core packages of the COMPAS framework.
https://compas.dev/compas/
MIT License
307 stars 104 forks source link

Better logging feedback (more assertions) #1216

Open zaczhuozhang opened 9 months ago

zaczhuozhang commented 9 months ago

Feature Request

As a user, I want the terminal logging to be more informational for easier debugging and tracing.

such output, and many others, are hard to trace the bug as a general user:

File "C:\Users\zaczz\miniconda3\envs\compas-dev\lib\site-packages\compas\datastructures\halfedge\halfedge.py", line 439, in add_face
    if u not in self.halfedge[v]:
KeyError: 3

while developers can make this more informational by using logging tools like loguru and enumerating possible exceptions during the development.

also, I would suggest more rigorous type hint.

gonzalocasas commented 9 months ago

Since we are talking about core here, I would not use logging or any derived tool, but instead I would add more assertions/checks and throw exceptions with meaningful messages

zaczhuozhang commented 9 months ago

agree, more assertions/checks with more information would help.

gonzalocasas commented 9 months ago

Oh don't close it, please, just update it to request more assertions instead of logging

zaczhuozhang commented 9 months ago

sure

jf--- commented 5 months ago

by using logging tools like loguru

+1 loguru makes logging a joy