error.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. clsyncmgr - intermediate daemon to aggregate clsync's sockets
  3. Copyright (C) 2014 Dmitry Yu Okunev <dyokunev@ut.mephi.ru> 0x8E30679C
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef __CLSYNC_ERROR_H
  16. #define __CLSYNC_ERROR_H
  17. #define BACKTRACE_LENGTH 256
  18. extern void _critical( const char *const function_name, const char *fmt, ...);
  19. #define critical(...) _critical(__FUNCTION__, __VA_ARGS__)
  20. extern void _error(const char *const function_name, const char *fmt, ...);
  21. #define error(...) _error(__FUNCTION__, __VA_ARGS__)
  22. extern void _warning(const char *const function_name, const char *fmt, ...);
  23. #define warning(...) _warning(__FUNCTION__, __VA_ARGS__)
  24. extern void _info(const char *const function_name, const char *fmt, ...);
  25. #define info(...) _info(__FUNCTION__, __VA_ARGS__)
  26. extern void _debug(int debug_level, const char *const function_name, const char *fmt, ...);
  27. #define debug(debug_level, ...) _debug(debug_level, __FUNCTION__, __VA_ARGS__)
  28. #define error_or_debug(debug_level, ...) ((debug_level)<0 ? _error(__FUNCTION__, __VA_ARGS__) : _debug(debug_level, __FUNCTION__, __VA_ARGS__))
  29. extern void error_init(void *_outputmethod, int *_quiet, int *_verbose, int *_debug);
  30. enum outputmethod {
  31. OM_STDERR = 0,
  32. OM_STDOUT,
  33. OM_SYSLOG,
  34. OM_MAX
  35. };
  36. typedef enum outputmethod outputmethod_t;
  37. #endif