diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-03-09 12:07:25 -0500 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-03-12 11:17:02 -0400 |
| commit | 688818844fe662dea093082c2717481779319f43 (patch) | |
| tree | db9387109c39e480d2df960d9a38ac1444708b0a /python/clidef.py | |
| parent | aea03ad6e8198a91578f550cb0c835020e673031 (diff) | |
lib: add convenience debugging macros
* Add DEBUG*() macros
This set of macros allows you to write printf-like debugging lines that
automatically check whether a debug is on before printing. This should
eliminate the need for explicit checks in simple cases. For example:
if (SUCH_AND_SUCH_DEBUG_IS_ON) {
zlog_warn(...);
}
Becomes:
DEBUG(warn, such_and_such, ...);
Or, equivalently,
DEBUGE(such_and_such, ...);
The levels passed to DEBUG are expanded into the names of zlog_*
functions, so the same zlog levels are available. There's also a set of
macros that have the level built into them; DEBUGE for errors, DEBUGW
for warnings, etc. Good for brevity.
* Add singular setting macros
Change the 'SET' macros to accept a boolean indicating whether the
provided bits should be set or unset, and map on/off macros to them.
Helps condense code where you already have a boolean condition that
tells you what you want to do as you can avoid writing the branch.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'python/clidef.py')
0 files changed, 0 insertions, 0 deletions
