aboutsummaryrefslogtreecommitdiffstats
path: root/src/Log.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli (think) <matthias@mpb.li>2012-09-13 22:42:47 +0200
committerMatthias P. Braendli (think) <matthias@mpb.li>2012-09-13 22:42:47 +0200
commit47c823ac611c54ae8ce3af2da40f9db0ec9b9195 (patch)
tree669e233651e50ef3ce84df314cde9e7c0f3a7bf3 /src/Log.cpp
parent95db3fa1e516aefa239f0dbe06bcda674e57b6a1 (diff)
downloaddabmod-47c823ac611c54ae8ce3af2da40f9db0ec9b9195.tar.gz
dabmod-47c823ac611c54ae8ce3af2da40f9db0ec9b9195.tar.bz2
dabmod-47c823ac611c54ae8ce3af2da40f9db0ec9b9195.zip
crc-dabmod: much cleaner logging implementation
Diffstat (limited to 'src/Log.cpp')
-rw-r--r--src/Log.cpp22
1 files changed, 7 insertions, 15 deletions
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 <list>
-#include <stdarg.h>
#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<LogBackend*>::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<LogBackend*>::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);
}