From: Antonio B. <bor...@gm...> - 2025-08-12 15:09:52
|
On Mon, Aug 11, 2025 at 6:07 PM R. Diez <rdi...@rd...> wrote: > > > > Today we have in OpenOCD > > enum log_levels { > > LOG_LVL_SILENT = -3, > > LOG_LVL_OUTPUT = -2, > > LOG_LVL_USER = -1, > > LOG_LVL_ERROR = 0, > > LOG_LVL_WARNING = 1, > > LOG_LVL_INFO = 2, > > LOG_LVL_DEBUG = 3, > > LOG_LVL_DEBUG_IO = 4, > > }; > > [...] > > My proposal is, as a first step, to simply add a new entry in > > "log_level": LOG_LVL_DEBUG_USB. Then convert current _DEBUG_USB_COMMS_ > > code under this new category. > > I think that should be doable. But before I delve into the details, I have another related question: > > After converting --enable-verbose-usb-comms to this method, I wanted to do the same with --enable-malloc-logging / _DEBUG_FREE_SPACE_ . > > Should I add a new LOG_LVL_DEBUG_MALLOC too? Like this: > > [...] > LOG_LVL_DEBUG = 3, > LOG_LVL_DEBUG_IO = 4, > LOG_LVL_DEBUG_USB= 5, // new > LOG_LVL_DEBUG_MALLOC= 6, // new I don't think it would make sense to have more levels. I mean, why enabling MALLOC should enable USB and not the opposite? There is no real hierarchy here. For backward compatibility, I would keep the levels USER, ERROR, WARNING, INFO, DEBUG in the future rework. Not sure about DEBUG_IO. But for all the new stuff, I would keep them at the same level while using different macros for easier code split in future. LOG_LVL_DEBUG_USB= 5, // new LOG_LVL_DEBUG_MALLOC= 5, // new LOG_LVL_DEBUG_...= 5, // new Antonio |