summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/debug.c5
-rw-r--r--src/util/util.h15
2 files changed, 15 insertions, 5 deletions
diff --git a/src/util/debug.c b/src/util/debug.c
index e57656d7..cb90d65a 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -256,3 +256,8 @@ int rotate_debug_files(void)
return open_debug_file();
}
+
+void talloc_log_fn(const char *message)
+{
+ DEBUG(SSSDBG_FATAL_FAILURE, (message));
+}
diff --git a/src/util/util.h b/src/util/util.h
index a96f519a..df57a3de 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -194,11 +194,15 @@ errno_t set_debug_file_from_fd(const int fd);
*/
#define DEBUG_IS_SET(level) (debug_level & (level))
-#define CONVERT_AND_SET_DEBUG_LEVEL(new_value) debug_level = ( \
- ((new_value) != SSSDBG_INVALID) \
- ? debug_convert_old_level(new_value) \
- : SSSDBG_UNRESOLVED /* Debug level should be loaded from config file. */ \
-);
+#define DEBUG_INIT(dbg_lvl) do { \
+ if (dbg_lvl != SSSDBG_INVALID) { \
+ debug_level = debug_convert_old_level(dbg_lvl); \
+ } else { \
+ debug_level = SSSDBG_UNRESOLVED; \
+ } \
+\
+ talloc_set_log_fn(talloc_log_fn); \
+} while (0)
#define PRINT(fmt, ...) fprintf(stdout, gettext(fmt), ##__VA_ARGS__)
#define ERROR(fmt, ...) fprintf(stderr, gettext(fmt), ##__VA_ARGS__)
@@ -341,6 +345,7 @@ void ldb_debug_messages(void *context, enum ldb_debug_level level,
int open_debug_file_ex(const char *filename, FILE **filep);
int open_debug_file(void);
int rotate_debug_files(void);
+void talloc_log_fn(const char *msg);
/* From sss_log.c */
#define SSS_LOG_EMERG 0 /* system is unusable */