summaryrefslogtreecommitdiffstats
path: root/src/util/debug.c
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2011-08-09 13:01:05 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-08-25 15:46:11 -0400
commit99dd40a885ed3d42af4bbbde7ee2fc98830544d0 (patch)
tree52cbd2a20ff339f751a6f08a1af78ace5563a924 /src/util/debug.c
parent267bdd44fc55e064412177b7a67c7a047c912177 (diff)
downloadsssd-99dd40a885ed3d42af4bbbde7ee2fc98830544d0.tar.gz
sssd-99dd40a885ed3d42af4bbbde7ee2fc98830544d0.tar.xz
sssd-99dd40a885ed3d42af4bbbde7ee2fc98830544d0.zip
New DEBUG facility - conversion
https://fedorahosted.org/sssd/ticket/925 Conversion of the old debug_level format to the new one. (only where it was necessary) Removed: SSS_DEFAULT_DEBUG_LEVEL (completely replaced with SSSDBG_DEFAULT)
Diffstat (limited to 'src/util/debug.c')
-rw-r--r--src/util/debug.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/util/debug.c b/src/util/debug.c
index cca92eb93..e7ae83860 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -33,7 +33,7 @@
const char *debug_prg_name = "sssd";
-int debug_level = SSS_UNRESOLVED_DEBUG_LEVEL;
+int debug_level = SSSDBG_UNRESOLVED;
int debug_timestamps = SSSDBG_TIMESTAMP_UNRESOLVED;
int debug_to_file = 0;
@@ -143,22 +143,22 @@ int debug_get_level(int old_level)
void ldb_debug_messages(void *context, enum ldb_debug_level level,
const char *fmt, va_list ap)
{
- int loglevel = -1;
+ int loglevel = SSSDBG_UNRESOLVED;
int ret;
char * message = NULL;
switch(level) {
case LDB_DEBUG_FATAL:
- loglevel = 0;
+ loglevel = SSSDBG_FATAL_FAILURE;
break;
case LDB_DEBUG_ERROR:
- loglevel = 1;
+ loglevel = SSSDBG_CRIT_FAILURE;
break;
case LDB_DEBUG_WARNING:
- loglevel = 6;
+ loglevel = SSSDBG_TRACE_FUNC;
break;
case LDB_DEBUG_TRACE:
- loglevel = 9;
+ loglevel = SSSDBG_TRACE_ALL;
break;
}
@@ -168,19 +168,8 @@ void ldb_debug_messages(void *context, enum ldb_debug_level level,
return;
}
- if (loglevel <= debug_level) {
- if (debug_timestamps) {
- time_t rightnow = time(NULL);
- char stamp[25];
- memcpy(stamp, ctime(&rightnow), 24);
- stamp[24] = '\0';
- debug_fn("(%s) [%s] [ldb] (%d): %s\n",
- stamp, debug_prg_name, loglevel, message);
- } else {
- debug_fn("[%s] [ldb] (%d): %s\n",
- debug_prg_name, loglevel, message);
- }
- }
+ DEBUG_MSG(loglevel, "ldb", message);
+
free(message);
}