summaryrefslogtreecommitdiffstats
path: root/raul/log.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-10 06:24:07 +0000
committerDavid Robillard <d@drobilla.net>2012-05-10 06:24:07 +0000
commitdd599c5663c6e5db8bdab0597935550c026d5f7b (patch)
treebf0298ba27f70f6562ef543d408c7d8bee2544ff /raul/log.hpp
parent4eb9aa529c2b3c083c64886234ead8f06ff5f77e (diff)
downloadraul-dd599c5663c6e5db8bdab0597935550c026d5f7b.tar.gz
raul-dd599c5663c6e5db8bdab0597935550c026d5f7b.tar.bz2
raul-dd599c5663c6e5db8bdab0597935550c026d5f7b.zip
Work towards translatable strings and a cleaner log interface.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4338 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/log.hpp')
-rw-r--r--raul/log.hpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/raul/log.hpp b/raul/log.hpp
index cbc9f14..d121290 100644
--- a/raul/log.hpp
+++ b/raul/log.hpp
@@ -1,5 +1,5 @@
/* This file is part of Raul.
- * Copyright 2009-2011 David Robillard <http://drobilla.net>
+ * Copyright 2009-2012 David Robillard <http://drobilla.net>
*
* Raul is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
@@ -18,12 +18,15 @@
#ifndef RAUL_LOG_HPP
#define RAUL_LOG_HPP
+#include <boost/format.hpp>
#include <iostream>
#include <sstream>
#include <string>
namespace Raul {
+typedef boost::basic_format<char> fmt;
+
/** Buffer for (possibly coloured) log printing.
* \ingroup raul
*/
@@ -85,10 +88,18 @@ protected:
int sync() { return 0; }
};
-extern std::ostream info;
-extern std::ostream warn;
-extern std::ostream error;
-extern std::ostream debug;
+class Log : public std::ostream {
+public:
+ Log(std::streambuf* buf) : std::ostream(buf) {}
+ template<typename T> Log& operator()(const T& o) {
+ *this << o; return *this;
+ }
+};
+
+extern Raul::Log info;
+extern Raul::Log warn;
+extern Raul::Log error;
+extern Raul::Log debug;
} // namespace Raul