log.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (C) 2023 joshua stein <jcs@jcs.org>
  2. //
  3. // This file is part of SCSI2SD.
  4. //
  5. // SCSI2SD is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // SCSI2SD is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with SCSI2SD. If not, see <http://www.gnu.org/licenses/>.
  17. #ifndef SCSI2SD_LOG_H
  18. #define SCSI2SD_LOG_H
  19. #include <stdbool.h>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #ifdef NETWORK_DEBUG_LOGGING
  24. extern bool g_log_debug;
  25. extern void logmsg_buf(const unsigned char *buf, unsigned long size);
  26. extern void logmsg_f(const char *format, ...);
  27. extern void dbgmsg_buf(const unsigned char *buf, unsigned long size);
  28. extern void dbgmsg_f(const char *format, ...);
  29. #define DBGMSG_BUF(buf, size) dbgmsg_buf(buf, size)
  30. #define DBGMSG_F(format, ...) dbgmsg_f(format, __VA_ARGS__);
  31. #define LOGMSG_BUF(buf, size) logmsg_buf(buf, size)
  32. #define LOGMSG_F(format, ...) logmsg_f(format, __VA_ARGS__);
  33. #else
  34. #define DBGMSG_BUF(buf, size) // Empty
  35. #define DBGMSG_F(format, ...) // Empty
  36. #define LOGMSG_BUF(buf, size) // Empty
  37. #define LOGMSG_F(format, ...) // Empty
  38. #endif // NETWORK_DEBUG_LOGGING
  39. #ifdef __cplusplus
  40. }
  41. #endif
  42. #endif // SCSI2SD_LOG_H