diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-09-18 12:35:34 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-09-21 10:35:10 -0400 |
commit | 8c50bd085c0efe5fde354deee2c8118887aae29d (patch) | |
tree | b3968a8878c533438aef689b79825915e2720ef2 /server/util/util.h | |
parent | 9570ca098cd0e92d1eb6aabc00fb8cac9fddd442 (diff) | |
download | sssd-8c50bd085c0efe5fde354deee2c8118887aae29d.tar.gz sssd-8c50bd085c0efe5fde354deee2c8118887aae29d.tar.xz sssd-8c50bd085c0efe5fde354deee2c8118887aae29d.zip |
Use syslog for logging error conditions in SSSD
This is just a band-aid until ELAPI is fully functional and ready to
use.
Diffstat (limited to 'server/util/util.h')
-rw-r--r-- | server/util/util.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/util/util.h b/server/util/util.h index ea7f44e83..1b039637f 100644 --- a/server/util/util.h +++ b/server/util/util.h @@ -30,6 +30,7 @@ #include <limits.h> #include <time.h> #include <pcre.h> +#include <syslog.h> #include "config.h" #include "talloc.h" #include "tevent.h" @@ -43,6 +44,7 @@ typedef int errno_t; extern const char *debug_prg_name; extern int debug_level; extern int debug_timestamps; +extern int send_syslog; void debug_fn(const char *format, ...); #define SSSD_DEBUG_OPTS \ @@ -81,6 +83,20 @@ void debug_fn(const char *format, ...); #define PRINT(fmt, ...) fprintf(stdout, gettext(fmt), ##__VA_ARGS__) #define ERROR(fmt, ...) fprintf(stderr, gettext(fmt), ##__VA_ARGS__) +#define SYSLOG_ERROR(...) do { \ + DEBUG(0, (__VA_ARGS__)); \ + if (send_syslog) { \ + syslog(LOG_ERR, __VA_ARGS__); \ + } \ +} while(0); + +#define SYSLOG_NOTICE(...) do { \ + DEBUG(0, (__VA_ARGS__)); \ + if (send_syslog) { \ + syslog(LOG_NOTICE, __VA_ARGS__); \ + } \ +} while(0); + #ifndef discard_const #define discard_const(ptr) ((void *)((uintptr_t)(ptr))) #endif |