[SSSD] [PATCHES] New DEBUG facility

Pavel Brezina pbrezina at redhat.com
Mon Aug 8 11:51:35 UTC 2011


https://fedorahosted.org/sssd/ticket/925

[PATCH 1/2]
There are several new macros in util/util.h:

- SSSDBG_* to reflect a debug level (same names as in the ticket) - please,
  don't use magic numbers anymore

- DEBUG_MSG(level, function, message) which will format the debug message
  like "(time) [prg_name] [function] (level): message\n"

- DEBUG_IS_SET(level) that you should use to check if the level is allowed
  to be logged
  You can use it like: if (DEBUG_IS_SET(SSSDBG_TRACE_LIBS)) {...}

[PATCH 2/2]
Changes unresolved debug level value (SSSDBG_UNRESOLVED) from -1 to 0
so DEBUG macro could be reduced by one condition. Anyway, it has a minor
effect, every time you want to load debug_level from command line parameters,
you have to use following pattern:

    /* Set debug level to invalid value so we can deside if -d 0 was used. */
    debug_level = SSSDBG_INVALID;

    pc = poptGetContext(argv[0], argc, argv, long_options, 0);
    while((opt = poptGetNextOpt(pc)) != -1) { ... }

    debug_level = debug_level != SSSDBG_INVALID
                  ? debug_convert_old_level(debug_level)
                  : SSSDBG_UNRESOLVED; /* Debug level should be loaded from config file. */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-New-DEBUG-facility.patch
Type: text/x-patch
Size: 56193 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20110808/fe20d14a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-New-DEBUG-facility-SSSDBG_UNRESOLVED-changed-from-1-.patch
Type: text/x-patch
Size: 28176 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20110808/fe20d14a/attachment-0001.bin>


More information about the sssd-devel mailing list