From a09576fbdc377a5f1f7409ad96153e810d8de5d0 Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Thu, 22 Oct 2015 10:04:00 +0200 Subject: [PATCH] LIB: introduce new warning message level This is to be used for non critical, non normal messages that don't break anything but need to be investigated by project admins. Needed in the file_upload_handler to find hosts that reupload result files and investigate the reason. --- lib/sched_msgs.cpp | 1 + lib/sched_msgs.h | 4 ++-- sched/file_upload_handler.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/sched_msgs.cpp b/lib/sched_msgs.cpp index 00bd1fe170..2b308b1ab8 100644 --- a/lib/sched_msgs.cpp +++ b/lib/sched_msgs.cpp @@ -24,6 +24,7 @@ SCHED_MSG_LOG log_messages; const char* SCHED_MSG_LOG::v_format_kind(int kind) const { switch(kind) { case MSG_CRITICAL: return "[CRITICAL]"; + case MSG_WARNING: return "[warning]"; case MSG_NORMAL: return ""; case MSG_DEBUG: return "[debug]"; default: return "*** internal error: invalid MessageKind ***"; diff --git a/lib/sched_msgs.h b/lib/sched_msgs.h index e0ca773532..47453e3c67 100644 --- a/lib/sched_msgs.h +++ b/lib/sched_msgs.h @@ -24,14 +24,14 @@ #include "boinc_fcgi.h" #endif -enum { MSG_CRITICAL=1, MSG_NORMAL, MSG_DEBUG }; +enum { MSG_CRITICAL=1, MSG_WARNING, MSG_NORMAL, MSG_DEBUG }; class SCHED_MSG_LOG : public MSG_LOG { const char* v_format_kind(int kind) const; bool v_message_wanted(int kind) const; public: int debug_level; - enum { MSG_CRITICAL=1, MSG_NORMAL, MSG_DEBUG }; + enum { MSG_CRITICAL=1, MSG_WARNING, MSG_NORMAL, MSG_DEBUG }; SCHED_MSG_LOG(): MSG_LOG(stderr) { debug_level = MSG_NORMAL; } void set_debug_level(int new_level) { debug_level = new_level; } void set_indent_level(const int new_indent_level); diff --git a/sched/file_upload_handler.cpp b/sched/file_upload_handler.cpp index e6a0bff0ad..00f3d919c8 100644 --- a/sched/file_upload_handler.cpp +++ b/sched/file_upload_handler.cpp @@ -164,7 +164,7 @@ int copy_socket_to_file(FILE* in, char* path, double offset, double nbytes) { // and made read-only; // return success to the client won't keep trying // - log_messages.printf(MSG_CRITICAL, + log_messages.printf(MSG_WARNING, "client tried to reupload the read-only file %s\n", path );