mirror of https://github.com/BOINC/boinc.git
- Added conditional printf to the message log class, since most scheduler log
output seems to be conditional on config parameters such as config.debug_version_select. svn path=/trunk/boinc/; revision=25998
This commit is contained in:
parent
31c4aa49c5
commit
9df37a1b89
|
@ -175,6 +175,36 @@ void MSG_LOG::printf_file(
|
|||
va_end(va);
|
||||
}
|
||||
|
||||
void MSG_LOG::cond_printf(int conditional,int kind, const char* format, ...) {
|
||||
if (conditional) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
vprintf(kind, format, va);
|
||||
va_end(va);
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_LOG::cond_printf_multiline(
|
||||
int conditional, int kind, const char* str, const char* prefix_format, ...
|
||||
) {
|
||||
if (conditional) {
|
||||
va_list va;
|
||||
va_start(va, prefix_format);
|
||||
vprintf_multiline(kind, str, prefix_format, va);
|
||||
va_end(va);
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_LOG::cond_printf_file(
|
||||
int conditional, int kind, const char* filename, const char* prefix_format, ...
|
||||
) {
|
||||
if (conditional) {
|
||||
va_list va;
|
||||
va_start(va, prefix_format);
|
||||
vprintf_file(kind, filename, prefix_format, va);
|
||||
va_end(va);
|
||||
}
|
||||
}
|
||||
// These SCOPE_MSG_LOG functions are utility functions that call their
|
||||
// corresponding MSG_LOG functions with the same name, passing the KIND that
|
||||
// was specified on creation of the SCOPE_MSG_LOG object.
|
||||
|
@ -204,3 +234,33 @@ void SCOPE_MSG_LOG::printf_file(
|
|||
va_end(va);
|
||||
}
|
||||
|
||||
void SCOPE_MSG_LOG::cond_printf(int conditional,const char* format, ...) {
|
||||
if (conditional) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
messages.vprintf(kind, format, va);
|
||||
va_end(va);
|
||||
}
|
||||
}
|
||||
|
||||
void SCOPE_MSG_LOG::cond_printf_multiline(
|
||||
int conditional,const char* str, const char* prefix_format, ...
|
||||
) {
|
||||
if (conditional) {
|
||||
va_list va;
|
||||
va_start(va, prefix_format);
|
||||
messages.vprintf_multiline(kind, str, prefix_format, va);
|
||||
va_end(va);
|
||||
}
|
||||
}
|
||||
|
||||
void SCOPE_MSG_LOG::cond_printf_file(
|
||||
int conditional,const char* filename, const char* prefix_format, ...
|
||||
) {
|
||||
if (conditional) {
|
||||
va_list va;
|
||||
va_start(va, prefix_format);
|
||||
messages.vprintf_file(kind, filename, prefix_format, va);
|
||||
va_end(va);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,11 @@ public:
|
|||
void vprintf_multiline(int kind, const char* str, const char* prefix_format, va_list va);
|
||||
void vprintf_file(int kind, const char* filename, const char* prefix_format, va_list va);
|
||||
|
||||
void cond_printf(int conditional,int kind, const char* format, ...) __attribute__ ((format (printf, 4, 5)));
|
||||
void cond_printf_multiline(int conditional,int kind, const char* str, const char* prefix_format, ...) __attribute__ ((format (printf, 5, 6)));
|
||||
void cond_printf_file(int conditional, int kind, const char* str, const char* prefix_format, ...) __attribute__ ((format (printf, 5, 6)));
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual const char* v_format_kind(int kind) const = 0;
|
||||
|
@ -88,6 +93,10 @@ public:
|
|||
void printf(const char* format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
void printf_multiline(const char* str, const char* prefix_format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
void printf_file(const char* filename, const char* prefix_format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
|
||||
void cond_printf(int conditional, const char* format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
void cond_printf_multiline(int conditional, const char* str, const char* prefix_format, ...) __attribute__ ((format (printf, 4, 5)));
|
||||
void cond_printf_file(int conditional, const char* str, const char* prefix_format, ...) __attribute__ ((format (printf, 4, 5)));
|
||||
};
|
||||
|
||||
#if _MSC_VER >= 1300
|
||||
|
|
Loading…
Reference in New Issue