add info_long() method to log filter

This commit is contained in:
Andre Puschmann 2019-10-18 12:31:34 +02:00
parent 755a0599c4
commit d5835fc8a0
3 changed files with 15 additions and 0 deletions

View File

@ -133,6 +133,7 @@ public:
virtual void error(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
virtual void warning(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
virtual void info(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
virtual void info_long(const char* message, ...) __attribute__((format(printf, 2, 3))) = 0;
virtual void debug(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
virtual void debug_long(const char* message, ...) __attribute__((format(printf, 2, 3))) = 0;

View File

@ -57,6 +57,7 @@ public:
void error(const char * message, ...) __attribute__ ((format (printf, 2, 3)));
void warning(const char * message, ...) __attribute__ ((format (printf, 2, 3)));
void info(const char * message, ...) __attribute__ ((format (printf, 2, 3)));
void info_long(const char* message, ...) __attribute__((format(printf, 2, 3)));
void debug(const char * message, ...) __attribute__ ((format (printf, 2, 3)));
void debug_long(const char* message, ...) __attribute__((format(printf, 2, 3)));

View File

@ -153,6 +153,19 @@ void log_filter::info(const char * message, ...) {
all_log_expand(LOG_LEVEL_INFO);
}
void log_filter::info_long(const char* message, ...)
{
if (level >= LOG_LEVEL_INFO) {
char* args_msg = NULL;
va_list args;
va_start(args, message);
if (vasprintf(&args_msg, message, args) > 0)
all_log(LOG_LEVEL_INFO, tti, args_msg, nullptr, strlen(args_msg), true);
va_end(args);
free(args_msg);
}
}
void log_filter::debug(const char * message, ...) {
all_log_expand(LOG_LEVEL_DEBUG);
}