1
0

our_syslog.h 742 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * our_syslog.h
  3. *
  4. * Syslog replacement functions
  5. */
  6. #ifndef _PPTPD_SYSLOG_H
  7. #define _PPTPD_SYSLOG_H
  8. /*
  9. * only enable this if you are debugging and running by hand
  10. * If init runs us you may not have an fd-2, and thus your write all over
  11. * someones FD and the die :-(
  12. */
  13. #undef USE_STDERR
  14. #ifdef USE_STDERR
  15. /*
  16. * Send all errors to stderr
  17. */
  18. #define openlog(a,b,c) ({})
  19. #define syslog(a,b,c...) ({fprintf(stderr, "pptpd syslog: " b "\n" , ## c);})
  20. #define closelog() ({})
  21. #define syslog_perror perror
  22. #else
  23. /*
  24. * Send all errors to syslog
  25. */
  26. #include <errno.h>
  27. #include <syslog.h>
  28. #define syslog_perror(s) syslog(LOG_ERR, "%s: %s", s, strerror(errno))
  29. #endif
  30. #endif /* !_PPTPD_SYSLOG_H */