From 47c823ac611c54ae8ce3af2da40f9db0ec9b9195 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli (think)" Date: Thu, 13 Sep 2012 22:42:47 +0200 Subject: crc-dabmod: much cleaner logging implementation --- src/Log.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/Log.cpp') diff --git a/src/Log.cpp b/src/Log.cpp index 8d04c58..2c4de21 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -24,7 +24,6 @@ */ #include -#include #include "Log.h" #include "porting.h" @@ -39,24 +38,17 @@ Logger::register_backend(LogBackend* backend) { //log(info, "Registered new logger " + backend->get_name()); } -void -Logger::operator()(log_level_t level, const char* fmt, ...) { - va_list arg_ptr; - va_start(arg_ptr, fmt); +void +Logger::log(log_level_t level, std::string message) { for (std::list::iterator it = backends.begin(); it != backends.end(); it++) { - (*it)->log(level, fmt, arg_ptr); + (*it)->log(level, message); } - va_end(arg_ptr); } -void -Logger::log(log_level_t level, const char* fmt, ...) { - va_list arg_ptr; - va_start(arg_ptr, fmt); - for (std::list::iterator it = backends.begin(); it != backends.end(); it++) { - (*it)->log(level, fmt, arg_ptr); - } - va_end(arg_ptr); +LogLine +Logger::level(log_level_t level) +{ + return LogLine(this, level); } -- cgit v1.2.3