mirror of
https://tinyplantnews.com/git2/ldaphotos
synced 2025-01-10 18:35:15 +00:00
980784ea29
Now accepts argument '-f', for which the argument is a file path. Opens file, then reads input from it. If file is not provided or fopen() fails, ldaphotos defaults to reading message from standard input.
31 lines
730 B
C
31 lines
730 B
C
#ifndef LDAP_LOG
|
|
#define LDAP_LOG
|
|
|
|
extern int run_verbose;
|
|
|
|
const char * currtime(void);
|
|
/*
|
|
Great, I remember why I chose to use a macro.
|
|
There's no good paradigm for passing the variadic arguments of printf
|
|
through another function.
|
|
|
|
I can use a paradigm wherein you just call the timestamper immediately
|
|
before printf()-ing your message, but like,
|
|
I dunno.
|
|
|
|
Let's see whether I can split the log(X) macro into this and a
|
|
function in log.h that supplies the time
|
|
*/
|
|
|
|
#ifdef USE_SYSLOG
|
|
#include <syslog.h>
|
|
#define log(Y, ...) syslog(Y, __VA_ARGS__)
|
|
#endif
|
|
#ifndef USE_SYSLOG
|
|
#define log(Y, ...) printf("%s %s", currtime(), __VA_ARGS__)
|
|
#endif
|
|
|
|
#define verb(...) if(run_verbose)log(LOG_DEBUG, __VA_ARGS__)
|
|
|
|
#endif
|