summaryrefslogtreecommitdiffstats
path: root/src/util/util.h
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2011-08-09 10:19:03 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-08-25 15:46:11 -0400
commita32ae272bb0ae0a47ab80d3a2fcc535fd5260754 (patch)
tree3e06169af97e8c8d27f3ea6debe1c0925e7cdc2e /src/util/util.h
parent24a5dc6614f3bd834d1b82c19cca8d3adc6a7653 (diff)
downloadsssd-a32ae272bb0ae0a47ab80d3a2fcc535fd5260754.tar.gz
sssd-a32ae272bb0ae0a47ab80d3a2fcc535fd5260754.tar.xz
sssd-a32ae272bb0ae0a47ab80d3a2fcc535fd5260754.zip
New DEBUG facility - new levels
https://fedorahosted.org/sssd/ticket/925 Added functions: - debug_convert_old_level() to convert levels 0-9 to appropriate bitmask debug_convert_old_level(5) returns 0x03F0 (= 0 | 1 | 2 | 3 | 4 | 5) - debug_get_level() to convert old level number to its new value debug_get_level(5) returns 0x0200 (= 5) 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
Diffstat (limited to 'src/util/util.h')
-rw-r--r--src/util/util.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/util/util.h b/src/util/util.h
index 3ff5f6292..acaaf4da3 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -57,10 +57,27 @@ extern int debug_timestamps;
extern int debug_to_file;
extern const char *debug_log_file;
void debug_fn(const char *format, ...);
+int debug_get_level(int old_level);
+int debug_convert_old_level(int old_level);
errno_t set_debug_file_from_fd(const int fd);
-#define SSS_DEFAULT_DEBUG_LEVEL 0
-#define SSS_UNRESOLVED_DEBUG_LEVEL -1
+#define SSS_DEFAULT_DEBUG_LEVEL SSSDBG_DEFAULT
+#define SSS_UNRESOLVED_DEBUG_LEVEL SSSDBG_UNRESOLVED
+
+#define SSSDBG_FATAL_FAILURE 0x0010 /* level 0 */
+#define SSSDBG_CRIT_FAILURE 0x0020 /* level 1 */
+#define SSSDBG_OP_FAILURE 0x0040 /* level 2 */
+#define SSSDBG_MINOR_FAILURE 0x0080 /* level 3 */
+#define SSSDBG_CONF_SETTINGS 0x0100 /* level 4 */
+#define SSSDBG_FUNC_DATA 0x0200 /* level 5 */
+#define SSSDBG_TRACE_FUNC 0x0400 /* level 6 */
+#define SSSDBG_TRACE_LIBS 0x1000 /* level 7 */
+#define SSSDBG_TRACE_INTERNAL 0x2000 /* level 8 */
+#define SSSDBG_TRACE_ALL 0x4000 /* level 9 */
+
+#define SSSDBG_UNRESOLVED -1
+#define SSSDBG_MASK_ALL 0xFFF0 /* enable all debug levels */
+#define SSSDBG_DEFAULT SSSDBG_FATAL_FAILURE
#define SSSDBG_TIMESTAMP_UNRESOLVED -1
#define SSSDBG_TIMESTAMP_DEFAULT 1