sched_msgs.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of BOINC.
  2. // http://boinc.berkeley.edu
  3. // Copyright (C) 2008 University of California
  4. //
  5. // BOINC is free software; you can redistribute it and/or modify it
  6. // under the terms of the GNU Lesser General Public License
  7. // as published by the Free Software Foundation,
  8. // either version 3 of the License, or (at your option) any later version.
  9. //
  10. // BOINC 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.
  13. // See the GNU Lesser General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Lesser General Public License
  16. // along with BOINC. If not, see <http://www.gnu.org/licenses/>.
  17. #ifndef BOINC_SCHED_MSGS_H
  18. #define BOINC_SCHED_MSGS_H
  19. #include "msg_log.h"
  20. #ifdef _USING_FCGI_
  21. #include "boinc_fcgi.h"
  22. #endif
  23. enum { MSG_CRITICAL=1, MSG_WARNING, MSG_NORMAL, MSG_DEBUG, MSG_DETAIL };
  24. class SCHED_MSG_LOG : public MSG_LOG {
  25. const char* v_format_kind(int kind) const;
  26. bool v_message_wanted(int kind) const;
  27. public:
  28. enum { MSG_CRITICAL=1, MSG_WARNING, MSG_NORMAL, MSG_DEBUG, MSG_DETAIL };
  29. SCHED_MSG_LOG(): MSG_LOG(stderr) { debug_level = MSG_NORMAL; }
  30. void set_file(FILE* f) {output=f;}
  31. void set_debug_level(int new_level) { debug_level = new_level; }
  32. bool debug() {return debug_level >= MSG_DEBUG;}
  33. bool detail() {return debug_level >= MSG_DETAIL;}
  34. #ifdef _USING_FCGI_
  35. ~SCHED_MSG_LOG();
  36. void redirect(FCGI_FILE* f);
  37. void close();
  38. void flush();
  39. #endif
  40. };
  41. #define _(x) "_(\"" x "\")"
  42. extern SCHED_MSG_LOG log_messages;
  43. #endif