add info_long() method to log filter

master
Andre Puschmann 5 years ago
parent 755a0599c4
commit d5835fc8a0

@ -133,6 +133,7 @@ public:
virtual void error(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0; 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 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(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(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
virtual void debug_long(const char* message, ...) __attribute__((format(printf, 2, 3))) = 0; virtual void debug_long(const char* message, ...) __attribute__((format(printf, 2, 3))) = 0;

@ -57,6 +57,7 @@ public:
void error(const char * message, ...) __attribute__ ((format (printf, 2, 3))); void error(const char * message, ...) __attribute__ ((format (printf, 2, 3)));
void warning(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(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(const char * message, ...) __attribute__ ((format (printf, 2, 3)));
void debug_long(const char* message, ...) __attribute__((format(printf, 2, 3))); void debug_long(const char* message, ...) __attribute__((format(printf, 2, 3)));

@ -153,6 +153,19 @@ void log_filter::info(const char * message, ...) {
all_log_expand(LOG_LEVEL_INFO); 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, ...) { void log_filter::debug(const char * message, ...) {
all_log_expand(LOG_LEVEL_DEBUG); all_log_expand(LOG_LEVEL_DEBUG);
} }

Loading…
Cancel
Save