OpenCyphal-Garage / gui_tool

Legacy cross-platform GUI application for UAVCAN/CAN v0 bus management and diagnostics. Does not support UAVCAN v1; for that, see Yukon.
http://legacy.uavcan.org
MIT License
85 stars 53 forks source link

Logger illumination #54

Closed PrincePepper closed 3 years ago

PrincePepper commented 3 years ago

How do you like the idea of making code highlighting for a more beautiful display?

Now: SharedScreenshot My idea: image

Sample code: logger.info('Param get/set response: '+LoggerCustomColor.BOLD+'%s'+LoggerCustomColor.ENDC, e.response)

Here is the class itself LoggerCustomColor:

class LoggerCustomColor:
    HEADER = '\033[95m'
    OKBLUE = '\033[94m'
    OKCYAN = '\033[96m'
    OKGREEN = '\033[92m'

    WARNING = '\033[93m'
    FAIL = '\033[91m'
    ENDC = '\033[0m'
    BOLD = '\033[1m'
    UNDERLINE = '\033[4m'
pavel-kirienko commented 3 years ago

This will break if stderr is not connected to a tty or if the terminal is not vt100-compatible. There are libraries out there like coloredlogs or colorama which automate this properly but I am not sure their addition is meaningful considering that this is a GUI tool, not a CLI one. If you often find yourself looking into CLI dumps of a GUI tool then maybe the GUI is worth redesigning.

PrincePepper commented 3 years ago

Thanks a lot. Sorry for bother