diff options
Diffstat (limited to 'source3/lib/system.c')
-rw-r--r-- | source3/lib/system.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c index 2a0889b356..8c7eec939e 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -1204,3 +1204,31 @@ const char *sys_dlerror(void) return NULL; #endif } + +/************************************************************************** + Wrapper for Admin Logs. +****************************************************************************/ + +void sys_adminlog(int priority, const char *format_str, ...) +{ + va_list ap; + int ret; + char **msgbuf = NULL; + + if (!lp_admin_log()) + return; + + va_start( ap, format_str ); + ret = vasprintf( msgbuf, format_str, ap ); + va_end( ap ); + + if (ret == -1) + return; + +#if defined(HAVE_SYSLOG) + syslog( priority, "%s", *msgbuf ); +#else + DEBUG(0,("%s", *msgbuf )); +#endif + SAFE_FREE(*msgbuf); +} |