diff options
author | David Robillard <d@drobilla.net> | 2012-05-10 06:24:07 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-10 06:24:07 +0000 |
commit | dd599c5663c6e5db8bdab0597935550c026d5f7b (patch) | |
tree | bf0298ba27f70f6562ef543d408c7d8bee2544ff | |
parent | 4eb9aa529c2b3c083c64886234ead8f06ff5f77e (diff) | |
download | raul-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
-rw-r--r-- | raul/AtomLiblo.hpp | 4 | ||||
-rw-r--r-- | raul/Path.hpp | 5 | ||||
-rw-r--r-- | raul/Process.hpp | 3 | ||||
-rw-r--r-- | raul/TableImpl.hpp | 1 | ||||
-rw-r--r-- | raul/Thread.hpp | 1 | ||||
-rw-r--r-- | raul/log.hpp | 21 | ||||
-rw-r--r-- | src/Thread.cpp | 2 | ||||
-rw-r--r-- | src/log.cpp | 8 |
8 files changed, 25 insertions, 20 deletions
diff --git a/raul/AtomLiblo.hpp b/raul/AtomLiblo.hpp index 13f48eb..3fc8ae0 100644 --- a/raul/AtomLiblo.hpp +++ b/raul/AtomLiblo.hpp @@ -20,8 +20,6 @@ #include <lo/lo.h> -#include <iostream> - #include "raul/log.hpp" #include "raul/Atom.hpp" @@ -88,7 +86,7 @@ lo_arg_to_atom(Raul::Forge& forge, char type, lo_arg* arg) return forge.make((bool)false); default: warn << "Unable to convert OSC type '" - << type << "' to Atom" << std::endl; + << type << "' to Atom" << std::endl; return Atom(); } } diff --git a/raul/Path.hpp b/raul/Path.hpp index a00740a..dd53ee5 100644 --- a/raul/Path.hpp +++ b/raul/Path.hpp @@ -18,11 +18,10 @@ #ifndef RAUL_PATH_HPP #define RAUL_PATH_HPP -#include <iostream> +#include <cassert> #include <cctype> -#include <string> #include <cstring> -#include <cassert> +#include <string> #include "raul/Symbol.hpp" #include "raul/URI.hpp" diff --git a/raul/Process.hpp b/raul/Process.hpp index 21e4f33..74065e2 100644 --- a/raul/Process.hpp +++ b/raul/Process.hpp @@ -22,7 +22,6 @@ #include <sys/time.h> #include <unistd.h> -#include <iostream> #include <string> #include "raul/Noncopyable.hpp" @@ -50,7 +49,7 @@ public: const std::string arguments = command.substr((command.find(" ") + 1)); info << "Launching child process '" << executable << "' with arguments '" - << arguments << "'" << std::endl; + << arguments << "'" << std::endl; // Use the same double fork() trick as JACK to prevent zombie children const int err = fork(); diff --git a/raul/TableImpl.hpp b/raul/TableImpl.hpp index 3f91f10..da73f0f 100644 --- a/raul/TableImpl.hpp +++ b/raul/TableImpl.hpp @@ -20,7 +20,6 @@ #include <algorithm> #include <cassert> -#include <iostream> #include <stdexcept> #include <utility> #include <vector> diff --git a/raul/Thread.hpp b/raul/Thread.hpp index b67531a..ecd896e 100644 --- a/raul/Thread.hpp +++ b/raul/Thread.hpp @@ -18,7 +18,6 @@ #ifndef RAUL_THREAD_HPP #define RAUL_THREAD_HPP -#include <iostream> #include <set> #include <string> 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 diff --git a/src/Thread.cpp b/src/Thread.cpp index 78edacc..f1b8f99 100644 --- a/src/Thread.cpp +++ b/src/Thread.cpp @@ -21,7 +21,7 @@ #include "raul/log.hpp" #include "raul/Thread.hpp" -#define LOG(s) s << "[" << _name << "] " +#define LOG(s) (s("[")(_name)("] ")) using std::endl; diff --git a/src/log.cpp b/src/log.cpp index 1c2afaf..ee020ff 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -46,10 +46,10 @@ NullBuffer debug_buffer; #endif // RAUL_LOG_COLOUR -std::ostream info(&info_buffer); -std::ostream warn(&warn_buffer); -std::ostream error(&error_buffer); -std::ostream debug(&debug_buffer); +Raul::Log info(&info_buffer); +Raul::Log warn(&warn_buffer); +Raul::Log error(&error_buffer); +Raul::Log debug(&debug_buffer); std::string Raul::LogBuffer::colour(Colour c) |