debug.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * libdpkg - Debian packaging suite library routines
  3. * debug.h - debugging support
  4. *
  5. * Copyright © 2011 Guillem Jover <guillem@debian.orgian>
  6. *
  7. * This is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. #ifndef LIBDPKG_DEBUG_H
  21. #define LIBDPKG_DEBUG_H
  22. #include <dpkg/macros.h>
  23. #include <stdbool.h>
  24. #include <stdio.h>
  25. DPKG_BEGIN_DECLS
  26. /**
  27. * @defgroup debug Debugging
  28. * @ingroup dpkg-internal
  29. * @{
  30. */
  31. /*
  32. * XXX: We do not use DPKG_BIT() here, because the octal values are part
  33. * of the current output interface.
  34. */
  35. enum debugflags {
  36. dbg_general = 01,
  37. dbg_scripts = 02,
  38. dbg_eachfile = 010,
  39. dbg_eachfiledetail = 0100,
  40. dbg_conff = 020,
  41. dbg_conffdetail = 0200,
  42. dbg_depcon = 040,
  43. dbg_depcondetail = 0400,
  44. dbg_veryverbose = 01000,
  45. dbg_stupidlyverbose = 02000,
  46. dbg_triggers = 010000,
  47. dbg_triggersdetail = 020000,
  48. dbg_triggersstupid = 040000,
  49. };
  50. void debug_set_output(FILE *output, const char *filename);
  51. void debug_set_mask(int mask);
  52. bool debug_has_flag(int flag);
  53. void debug(int flag, const char *fmt, ...) DPKG_ATTR_PRINTF(2);
  54. /** @} */
  55. DPKG_END_DECLS
  56. #endif /* LIBDPKG_DEBUG_H */