From cb5e934666e128e27faa95587fbdecf01f0e324d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 6 Jan 2010 23:49:17 +0000 Subject: Do all logging output via Raul streams. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2349 a436a847-0d15-0410-975c-d299462d15a1 --- src/module/World.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/module') diff --git a/src/module/World.cpp b/src/module/World.cpp index d5e50a9e..e3b93c8f 100644 --- a/src/module/World.cpp +++ b/src/module/World.cpp @@ -15,15 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include #include #include +#include "raul/log.hpp" #include "ingen-config.h" #include "shared/runtime_paths.hpp" #include "World.hpp" +#define LOG(s) s << "[Module] " + using namespace std; +using namespace Raul; namespace Ingen { namespace Shared { @@ -52,11 +55,11 @@ load_module(const string& name) if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { module = new Glib::Module(filename, Glib::MODULE_BIND_LAZY); if (*module) { - cerr << "[Module] Loaded \"" << name << "\" from " << filename << endl; + LOG(info) << "Loaded \"" << name << "\" from " << filename << endl; return SharedPtr(module); } else { delete module; - cerr << Glib::Module::get_last_error() << endl; + error << Glib::Module::get_last_error() << endl; } } } @@ -68,16 +71,16 @@ load_module(const string& name) Glib::MODULE_BIND_LAZY); if (*module) { - cerr << "[Module] Loaded \"" << name << "\" from " << INGEN_MODULE_DIR << endl; + LOG(info) << "Loaded \"" << name << "\" from " << INGEN_MODULE_DIR << endl; return SharedPtr(module); } else if (!module_path_found) { - cerr << "[Module] Unable to find " << name + LOG(error) << "Unable to find " << name << " (" << Glib::Module::get_last_error() << ")" << endl; return SharedPtr(); } else { - cerr << "[Module] Unable to load " << name << " from " << module_path + LOG(error) << "Unable to load " << name << " from " << module_path << " (" << Glib::Module::get_last_error() << ")" << endl; - cerr << "Is Ingen installed? Use ./ingen.dev to run from the source tree." << endl; + LOG(error) << "Is Ingen installed?" << endl; return SharedPtr(); } } @@ -97,7 +100,7 @@ World::load(const char* name) modules.insert(make_pair(string(name), module)); return true; } else { - cerr << "Failed to load module " << name << endl; + LOG(error) << "Failed to load module " << name << endl; return false; } } @@ -120,7 +123,7 @@ World::interface(const std::string& url) const string scheme = url.substr(0, url.find(":")); const InterfaceFactories::const_iterator i = interface_factories.find(scheme); if (i == interface_factories.end()) { - cerr << "WARNING: Unknown URI scheme `'" << scheme << "'" << endl; + warn << "Unknown URI scheme `'" << scheme << "'" << endl; return SharedPtr(); } @@ -134,7 +137,7 @@ World::run(const std::string& mime_type, const std::string& filename) { const ScriptRunners::const_iterator i = script_runners.find(mime_type); if (i == script_runners.end()) { - cerr << "WARNING: Unknown script MIME type `'" << mime_type << "'" << endl; + warn << "Unknown script MIME type `'" << mime_type << "'" << endl; return false; } -- cgit v1.2.1