diff options
author | Michal Zidek <mzidek@redhat.com> | 2012-10-15 15:24:15 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2012-10-29 17:15:37 +0100 |
commit | 9e2c64c6d4f5560e27207193efea6536a566865e (patch) | |
tree | 506ae170ee255081ebfa76ad25bc7a136b47914c /src/util | |
parent | 644db36ab1111b88abca57d2438b72d618403dde (diff) | |
download | sssd-9e2c64c6d4f5560e27207193efea6536a566865e.tar.gz sssd-9e2c64c6d4f5560e27207193efea6536a566865e.tar.bz2 sssd-9e2c64c6d4f5560e27207193efea6536a566865e.zip |
Include talloc log in our debug facility
https://fedorahosted.org/sssd/ticket/1495
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/debug.c | 5 | ||||
-rw-r--r-- | src/util/util.h | 15 |
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 */ |