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.
This commit is contained in:
Christian Beer 2015-10-22 10:04:00 +02:00
parent bff1cafe50
commit a09576fbdc
3 changed files with 4 additions and 3 deletions

View File

@ -24,6 +24,7 @@ SCHED_MSG_LOG log_messages;
const char* SCHED_MSG_LOG::v_format_kind(int kind) const { const char* SCHED_MSG_LOG::v_format_kind(int kind) const {
switch(kind) { switch(kind) {
case MSG_CRITICAL: return "[CRITICAL]"; case MSG_CRITICAL: return "[CRITICAL]";
case MSG_WARNING: return "[warning]";
case MSG_NORMAL: return ""; case MSG_NORMAL: return "";
case MSG_DEBUG: return "[debug]"; case MSG_DEBUG: return "[debug]";
default: return "*** internal error: invalid MessageKind ***"; default: return "*** internal error: invalid MessageKind ***";

View File

@ -24,14 +24,14 @@
#include "boinc_fcgi.h" #include "boinc_fcgi.h"
#endif #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 { class SCHED_MSG_LOG : public MSG_LOG {
const char* v_format_kind(int kind) const; const char* v_format_kind(int kind) const;
bool v_message_wanted(int kind) const; bool v_message_wanted(int kind) const;
public: public:
int debug_level; 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; } SCHED_MSG_LOG(): MSG_LOG(stderr) { debug_level = MSG_NORMAL; }
void set_debug_level(int new_level) { debug_level = new_level; } void set_debug_level(int new_level) { debug_level = new_level; }
void set_indent_level(const int new_indent_level); void set_indent_level(const int new_indent_level);

View File

@ -164,7 +164,7 @@ int copy_socket_to_file(FILE* in, char* path, double offset, double nbytes) {
// and made read-only; // and made read-only;
// return success to the client won't keep trying // 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", "client tried to reupload the read-only file %s\n",
path path
); );