diff options
author | David Robillard <d@drobilla.net> | 2010-01-06 23:49:17 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-01-06 23:49:17 +0000 |
commit | cb5e934666e128e27faa95587fbdecf01f0e324d (patch) | |
tree | 1e694e2812381efbb3eb4b5ace2cdecc118b29f6 /src/client | |
parent | 092eb35edb999a9dd809e197d7dd9a4ebb0d6bd5 (diff) | |
download | ingen-cb5e934666e128e27faa95587fbdecf01f0e324d.tar.gz ingen-cb5e934666e128e27faa95587fbdecf01f0e324d.tar.bz2 ingen-cb5e934666e128e27faa95587fbdecf01f0e324d.zip |
Do all logging output via Raul streams.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2349 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/ClientStore.cpp | 65 | ||||
-rw-r--r-- | src/client/DeprecatedLoader.cpp | 33 | ||||
-rw-r--r-- | src/client/HTTPClientReceiver.cpp | 32 | ||||
-rw-r--r-- | src/client/HTTPEngineSender.cpp | 5 | ||||
-rw-r--r-- | src/client/NodeModel.hpp | 1 | ||||
-rw-r--r-- | src/client/OSCClientReceiver.cpp | 16 | ||||
-rw-r--r-- | src/client/OSCEngineSender.cpp | 8 | ||||
-rw-r--r-- | src/client/ObjectModel.cpp | 1 | ||||
-rw-r--r-- | src/client/ObjectModel.hpp | 1 | ||||
-rw-r--r-- | src/client/PatchModel.cpp | 4 | ||||
-rw-r--r-- | src/client/PluginModel.hpp | 1 | ||||
-rw-r--r-- | src/client/PluginUI.cpp | 16 | ||||
-rw-r--r-- | src/client/PortModel.hpp | 4 | ||||
-rw-r--r-- | src/client/ThreadedSigClientInterface.cpp | 7 |
14 files changed, 95 insertions, 99 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 5d80af50..73d2b23e 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -15,6 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "raul/log.hpp" #include "raul/PathTable.hpp" #include "ClientStore.hpp" #include "ObjectModel.hpp" @@ -25,6 +26,8 @@ #include "PatchModel.hpp" #include "SigClientInterface.hpp" +#define LOG(s) s << "[ClientStore] " + using namespace std; using namespace Raul; @@ -96,11 +99,11 @@ ClientStore::add_object(SharedPtr<ObjectModel> object) i != object->properties().end(); ++i) object->signal_property(i->first, i->second); - /*cout << "[Store] Added " << object->path() << " {" << endl; + LOG(debug) << "Added " << object->path() << " {" << endl; for (iterator i = begin(); i != end(); ++i) { - cout << "\t" << i->first << endl; + LOG(debug) << "\t" << i->first << endl; } - cout << "}" << endl;*/ + LOG(debug) << "}" << endl; } @@ -116,11 +119,11 @@ ClientStore::remove_object(const Path& path) iterator descendants_end = find_descendants_end(i); SharedPtr<Store::Objects> removed = yank(i, descendants_end); - /*cout << "[Store] Removing " << i->first << " {" << endl; - for (iterator i = removed.begin(); i != removed.end(); ++i) { - cout << "\t" << i->first << endl; + LOG(debug) << "[ClientStore] Removing " << i->first << " {" << endl; + for (iterator i = removed->begin(); i != removed->end(); ++i) { + LOG(debug) << "\t" << i->first << endl; } - cout << "}" << endl;*/ + LOG(debug) << "}" << endl; if (result) result->signal_destroyed.emit(); @@ -201,7 +204,7 @@ ClientStore::del(const Path& path) { SharedPtr<ObjectModel> removed = remove_object(path); removed.reset(); - //cerr << "[ClientStore] removed object " << path << ", count: " << removed.use_count(); + debug << "[ClientStore] removed object " << path << ", count: " << removed.use_count(); } void @@ -212,7 +215,7 @@ ClientStore::move(const Path& old_path_str, const Path& new_path_str) iterator parent = find(old_path); if (parent == end()) { - cerr << "[Store] Failed to find object " << old_path << " to move." << endl; + LOG(error) << "Failed to find object " << old_path << " to move." << endl; return; } @@ -233,20 +236,12 @@ ClientStore::move(const Path& old_path_str, const Path& new_path_str) else child_new_path = new_path.base() + child_old_path.substr(old_path.length()+1); - cerr << "[Store] Renamed " << child_old_path << " -> " << child_new_path << endl; + LOG(info) << "Renamed " << child_old_path << " -> " << child_new_path << endl; PtrCast<ObjectModel>(i->second)->set_path(child_new_path); i->first = child_new_path; } cram(*removed.get()); - - //cerr << "[Store] Table:" << endl; - //for (size_t i=0; i < removed.size(); ++i) { - // cerr << removed[i].first << "\t\t: " << removed[i].second << endl; - //} - /*for (iterator i = begin(); i != end(); ++i) { - cerr << i->first << "\t\t: " << i->second << endl; - }*/ } @@ -254,10 +249,10 @@ void ClientStore::put(const URI& uri, const Resource::Properties& properties) { typedef Resource::Properties::const_iterator iterator; - /*cerr << "CLIENT PUT " << uri << " {" << endl; + LOG(debug) << "PUT " << uri << " {" << endl; for (iterator i = properties.begin(); i != properties.end(); ++i) - cerr << "\t" << i->first << " = " << i->second << " :: " << i->second.type() << endl; - cerr << "}" << endl;*/ + LOG(debug) << " " << i->first << " = " << i->second << " :: " << i->second.type() << endl; + LOG(debug) << "}" << endl; bool is_path = Path::is_valid(uri.str()); bool is_meta = ResourceImpl::is_meta_uri(uri); @@ -273,7 +268,7 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) string path_str = is_meta ? (string("/") + uri.chop_start("#")) : uri.str(); if (!Path::is_valid(path_str)) { - cerr << "ERROR: Bad path: " << uri.str() << " - " << path_str << endl; + LOG(error) << "Bad path: " << uri.str() << " - " << path_str << endl; return; } @@ -302,7 +297,7 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) SharedPtr<PluginModel> plug; if (p->second.is_valid() && p->second.type() == Atom::URI) { if (!(plug = plugin(p->second.get_uri()))) { - cout << "WARNING: Unable to find plugin " << p->second.get_uri() << endl; + LOG(warn) << "Unable to find plugin " << p->second.get_uri() << endl; plug = SharedPtr<PluginModel>( new PluginModel(p->second.get_uri(), "ingen:nil", Resource::Properties())); add_plugin(plug); @@ -312,7 +307,7 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) n->set_properties(properties); add_object(n); } else { - cerr << "ERROR: Plugin with no type" << endl; + LOG(error) << "Plugin with no type" << endl; } } else if (is_port) { if (data_type != PortType::UNKNOWN) { @@ -321,10 +316,10 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) p->set_properties(properties); add_object(p); } else { - cerr << "WARNING: Port " << path << " has no type" << endl; + LOG(warn) << "Port " << path << " has no type" << endl; } } else { - cerr << "WARNING: Ignoring object " << path << " with unknown type " + LOG(warn) << "Ignoring object " << path << " with unknown type " << is_patch << " " << is_node << " " << is_port << endl; } } @@ -337,7 +332,7 @@ ClientStore::set_property(const URI& subject_uri, const URI& predicate, const At size_t hash = subject_uri.find("#"); if (!value.is_valid()) { - cerr << "ERROR: Property '" << predicate << "' is invalid" << endl; + LOG(error) << "Property '" << predicate << "' is invalid" << endl; } else if (subject) { subject->set_property(predicate, value); } else if (ResourceImpl::is_meta_uri(subject_uri)) { @@ -350,7 +345,7 @@ ClientStore::set_property(const URI& subject_uri, const URI& predicate, const At if (plugin) plugin->set_property(predicate, value); else - cerr << "WARNING: Property '" << predicate << "' for unknown object " << subject_uri << endl; + LOG(warn) << "Property '" << predicate << "' for unknown object " << subject_uri << endl; } } @@ -362,7 +357,7 @@ ClientStore::set_port_value(const Path& port_path, const Atom& value) if (port) port->value(value); else - cerr << "ERROR: Control change for non-existent port " << port_path << endl; + LOG(error) << "Control change for non-existent port " << port_path << endl; } @@ -373,7 +368,7 @@ ClientStore::set_voice_value(const Path& port_path, uint32_t voice, const Atom& if (port) port->value(voice, value); else - cerr << "ERROR: Polyphonic control change for non-existent port " << port_path << endl; + LOG(error) << "Polyphonic control change for non-existent port " << port_path << endl; } @@ -384,7 +379,7 @@ ClientStore::activity(const Path& path) if (port) port->signal_activity.emit(); else - cerr << "ERROR: Activity for non-existent port " << path << endl; + LOG(error) << "Activity for non-existent port " << path << endl; } @@ -406,7 +401,7 @@ ClientStore::connection_patch(const Path& src_port_path, const Path& dst_port_pa patch = PtrCast<PatchModel>(this->object(src_port_path.parent().parent())); if (!patch) - cerr << "ERROR: Unable to find connection patch " << src_port_path + LOG(error) << "Unable to find connection patch " << src_port_path << " -> " << dst_port_path << endl; return patch; @@ -458,19 +453,19 @@ ClientStore::disconnect(const Path& src_port_path, const Path& dst_port_path) if (src_port) src_port->disconnected_from(dst_port); else - cerr << "WARNING: Disconnection from non-existent src port " << src_port_path << endl; + LOG(warn) << "Disconnection from non-existent src port " << src_port_path << endl; if (dst_port) dst_port->disconnected_from(dst_port); else - cerr << "WARNING: Disconnection from non-existent dst port " << dst_port_path << endl; + LOG(warn) << "Disconnection from non-existent dst port " << dst_port_path << endl; SharedPtr<PatchModel> patch = connection_patch(src_port_path, dst_port_path); if (patch) patch->remove_connection(src_port_path, dst_port_path); else - cerr << "ERROR: Disconnection in non-existent patch: " + LOG(error) << "Disconnection in non-existent patch: " << src_port_path << " -> " << dst_port_path << endl; } diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp index bbc5905d..088bf17d 100644 --- a/src/client/DeprecatedLoader.cpp +++ b/src/client/DeprecatedLoader.cpp @@ -15,7 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <iostream> #include <fstream> #include <vector> #include <algorithm> @@ -28,10 +27,13 @@ #include <libxml/parser.h> #include <libxml/tree.h> #include <libxml/xpath.h> +#include "raul/log.hpp" #include "raul/Path.hpp" #include "interface/EngineInterface.hpp" #include "DeprecatedLoader.hpp" +#define LOG(s) s << "[DeprecatedLoader] " + #define NS_INTERNALS "http://drobilla.net/ns/ingen-internals#" using namespace std; @@ -211,7 +213,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, GraphObject::Properties initial_data, bool existing) { - cerr << "[DeprecatedLoader] Loading patch " << filename << " under " + LOG(info) << "Loading patch " << filename << " under " << parent_path << " / " << name << endl; Path path("/"); @@ -233,20 +235,20 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, xmlDocPtr doc = xmlParseFile(filename.c_str()); if (!doc) { - cerr << "Unable to parse patch file." << endl; + LOG(error) << "Unable to parse patch file." << endl; return ""; } xmlNodePtr cur = xmlDocGetRootElement(doc); if (!cur) { - cerr << "Empty document." << endl; + LOG(error) << "Empty document." << endl; xmlFreeDoc(doc); return ""; } if (xmlStrcmp(cur->name, (const xmlChar*) "patch")) { - cerr << "File is not an Ingen patch file (root node != <patch>)" << endl; + LOG(error) << "File is not an Om patch file (root node != <patch>)" << endl; xmlFreeDoc(doc); return ""; } @@ -340,7 +342,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, _engine->set_port_value(translate_load_path(i->port_path().str()), Atom(value)); } } else { - cerr << "WARNING: Unknown preset: \"" << pm->name() << endl; + LOG(warn) << "Unknown preset: \"" << pm->name() << endl; } } cur = cur->next; @@ -443,8 +445,8 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr } if (path == "") { - cerr << "[DeprecatedLoader] Malformed patch file (node tag has empty children)" << endl; - cerr << "[DeprecatedLoader] Node ignored." << endl; + LOG(error) << "Malformed patch file (node tag has empty children)" << endl; + LOG(error) << "Node ignored." << endl; return false; } @@ -483,7 +485,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr _engine->put(path, props); } else { is_port = false; - cerr << "WARNING: Unknown internal plugin label \"" << plugin_label << "\"" << endl; + LOG(warn) << "Unknown internal plugin label \"" << plugin_label << "\"" << endl; } } @@ -492,7 +494,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr const string new_path = (Path::is_valid(old_path) ? old_path : Path::pathify(old_path)); if (!Path::is_valid(old_path)) - cerr << "WARNING: Translating invalid port path \"" << old_path << "\" => \"" + LOG(warn) << "Translating invalid port path \"" << old_path << "\" => \"" << new_path << "\"" << endl; // Set up translations (for connections etc) to alias both the old @@ -584,7 +586,7 @@ DeprecatedLoader::load_subpatch(const string& base_filename, const Path& parent, cur = cur->next; } - cout << "[DeprecatedLoader] Loading subpatch " << filename << " under " << parent << endl; + LOG(info) << "Loading subpatch " << filename << " under " << parent << endl; // load_patch sets the passed variable last, so values stored in the parent // will override values stored in the child patch file load_patch(filename, false, parent, Symbol(nameify_if_invalid(name)), initial_data, false); @@ -623,8 +625,8 @@ DeprecatedLoader::load_connection(const Path& parent, xmlDocPtr doc, const xmlNo } if (source_node == "" || source_port == "" || dest_node == "" || dest_port == "") { - cerr << "ERROR: Malformed patch file (connection tag has empty children)" << endl; - cerr << "ERROR: Connection ignored." << endl; + LOG(error) << "Malformed patch file (connection tag has empty children)" << endl; + LOG(error) << "Connection ignored." << endl; return false; } @@ -689,8 +691,7 @@ DeprecatedLoader::load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePt if (port_name == "") { string msg = "Unable to parse control in patch file ( node = "; msg.append(node_name).append(", port = ").append(port_name).append(")"); - cerr << "ERROR: " << msg << endl; - //m_client_hooks->error(msg); + LOG(error) << msg << endl; } else { // FIXME: temporary compatibility, remove any slashes from port name // remove this soon once patches have migrated @@ -706,7 +707,7 @@ DeprecatedLoader::load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePt cur = cur->next; } if (pm->name() == "") { - cerr << "Preset in patch file has no name." << endl; + LOG(error) << "Preset in patch file has no name." << endl; //m_client_hooks->error("Preset in patch file has no name."); pm->name("Unnamed"); } diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp index 879d648a..9545bbe6 100644 --- a/src/client/HTTPClientReceiver.cpp +++ b/src/client/HTTPClientReceiver.cpp @@ -18,14 +18,16 @@ #include <list> #include <cassert> #include <cstring> -#include <iostream> #include <sstream> #include <sys/socket.h> #include <errno.h> +#include "raul/log.hpp" #include "raul/Atom.hpp" #include "module/Module.hpp" #include "HTTPClientReceiver.hpp" +#define LOG(s) s << "[HTTPClientReceiver] " + using namespace std; using namespace Raul; @@ -71,7 +73,7 @@ HTTPClientReceiver::Listener::Listener(HTTPClientReceiver* receiver, const std:: string port_str = uri.substr(uri.find_last_of(":")+1); int port = atoi(port_str.c_str()); - cout << "Client HTTP listen: " << uri << " (port " << port << ")" << endl; + LOG(info) << "Client HTTP listen: " << uri << " (port " << port << ")" << endl; struct sockaddr_in servaddr; @@ -82,21 +84,21 @@ HTTPClientReceiver::Listener::Listener(HTTPClientReceiver* receiver, const std:: // Create listen socket if ((_sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - cerr << "Error creating listening socket: %s" << strerror(errno) << endl; + LOG(error) << "Error creating listening socket: %s" << strerror(errno) << endl; _sock = -1; return; } // Set remote address (FIXME: always localhost) if (inet_aton("127.0.0.1", &servaddr.sin_addr) <= 0) { - cerr << "Invalid remote IP address" << endl; + LOG(error) << "Invalid remote IP address" << endl; _sock = -1; return; } // Connect to server if (connect(_sock, (struct sockaddr*)&servaddr, sizeof(servaddr)) < 0) { - cerr << "Error calling connect: " << strerror(errno) << endl; + LOG(error) << "Error calling connect: " << strerror(errno) << endl; _sock = -1; return; } @@ -127,7 +129,7 @@ HTTPClientReceiver::close_session() void HTTPClientReceiver::update(const std::string& str) { - cout << _world->parser->parse_update(_world, _target.get(), str, _url); + LOG(info) << _world->parser->parse_update(_world, _target.get(), str, _url); } void @@ -155,7 +157,7 @@ HTTPClientReceiver::Listener::_run() } } - cout << "HTTP listener finished" << endl; + LOG(info) << "HTTP listener finished" << endl; } @@ -168,11 +170,11 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi HTTPClientReceiver* me = (HTTPClientReceiver*)ptr; const string path = soup_message_get_uri(msg)->path; - /*cerr << "HTTP MESSAGE " << path << endl; - cerr << msg->response_body->data << endl;*/ + /*LOG(debug) << path << endl + << msg->response_body->data << endl;*/ if (msg->response_body->data == NULL) { - cerr << "EMPTY CLIENT MESSAGE" << endl; + LOG(error) << "Empty client message" << endl; return; } @@ -181,7 +183,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi } else if (path == "/plugins") { if (msg->response_body->data == NULL) { - cout << "ERROR: Empty response" << endl; + LOG(error) << "Empty response" << endl; } else { Glib::Mutex::Lock lock(me->_mutex); me->_target->response_ok(0); @@ -191,7 +193,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi } else if (path == "/patch") { if (msg->response_body->data == NULL) { - cout << "ERROR: Empty response" << endl; + LOG(error) << "Empty response" << endl; } else { Glib::Mutex::Lock lock(me->_mutex); me->_target->response_ok(0); @@ -202,19 +204,19 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi } else if (path == "/stream") { if (msg->response_body->data == NULL) { - cout << "ERROR: Empty response" << endl; + LOG(error) << "Empty response" << endl; } else { Glib::Mutex::Lock lock(me->_mutex); string uri = string(soup_uri_to_string(soup_message_get_uri(msg), false)); uri = uri.substr(0, uri.find_last_of(":")); uri += string(":") + msg->response_body->data; - cout << "Stream URI: " << uri << endl; + LOG(info) << "Stream URI: " << uri << endl; me->_listener = boost::shared_ptr<Listener>(new Listener(me, uri)); me->_listener->start(); } } else { - cerr << "UNKNOWN MESSAGE: " << path << endl; + LOG(error) << "Unknown message: " << path << endl; me->update(msg->response_body->data); } } diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp index ab8c7c3f..105d54a8 100644 --- a/src/client/HTTPEngineSender.cpp +++ b/src/client/HTTPEngineSender.cpp @@ -15,15 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <iostream> #include <libsoup/soup.h> +#include "raul/log.hpp" #include "raul/AtomRDF.hpp" #include "redlandmm/Model.hpp" #include "module/World.hpp" #include "HTTPEngineSender.hpp" #include "HTTPClientReceiver.hpp" - using namespace std; using namespace Raul; @@ -229,7 +228,7 @@ HTTPEngineSender::get(const URI& uri) void HTTPEngineSender::request_property(const URI& object_path, const URI& key) { - cerr << "HTTP REQUEST PROPERTY" << endl; + warn << "TODO: HTTP request property" << endl; } diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp index 57d2f09c..b1dbb616 100644 --- a/src/client/NodeModel.hpp +++ b/src/client/NodeModel.hpp @@ -19,7 +19,6 @@ #define NODEMODEL_H #include <cstdlib> -#include <iostream> #include <string> #include <vector> #include <sigc++/sigc++.h> diff --git a/src/client/OSCClientReceiver.cpp b/src/client/OSCClientReceiver.cpp index 02585d3a..bb3c098a 100644 --- a/src/client/OSCClientReceiver.cpp +++ b/src/client/OSCClientReceiver.cpp @@ -15,13 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "OSCClientReceiver.hpp" -#include "raul/AtomLiblo.hpp" #include <list> #include <cassert> #include <cstring> -#include <iostream> #include <sstream> +#include "raul/log.hpp" +#include "raul/AtomLiblo.hpp" +#include "OSCClientReceiver.hpp" + +#define LOG(s) s << "[OSCClientReceiver] " using namespace std; using namespace Raul; @@ -66,10 +68,10 @@ OSCClientReceiver::start(bool dump_osc) } if (_st == NULL) { - cerr << "[OSCClientReceiver] Could not start OSC listener. Aborting." << endl; + LOG(error) << "Could not start OSC listener. Aborting." << endl; exit(EXIT_FAILURE); } else { - cout << "[OSCClientReceiver] Started OSC listener on port " << lo_server_thread_get_port(_st) << endl; + LOG(info) << "Started OSC listener on port " << lo_server_thread_get_port(_st) << endl; } // Print all incoming messages @@ -121,7 +123,7 @@ OSCClientReceiver::generic_cb(const char* path, const char* types, lo_arg** argv void OSCClientReceiver::lo_error_cb(int num, const char* msg, const char* path) { - cerr << "Got error from server: " << msg << endl; + LOG(error) << "Got error from server: " << msg << endl; } @@ -132,7 +134,7 @@ OSCClientReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv std::string msg = "Received unknown OSC message: "; msg += path; - cerr << msg << endl; + LOG(error) << msg << endl; return 0; } diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp index e2553528..0e2b11ab 100644 --- a/src/client/OSCEngineSender.cpp +++ b/src/client/OSCEngineSender.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <iostream> +#include "raul/log.hpp" #include "raul/AtomLiblo.hpp" #include "raul/Path.hpp" #include "OSCEngineSender.hpp" @@ -23,6 +23,8 @@ #include "common/interface/Port.hpp" #include "common/interface/Plugin.hpp" +#define LOG(s) s << "[OSCEngineSender] " + using namespace std; using namespace Raul; @@ -65,11 +67,11 @@ OSCEngineSender::attach(int32_t ping_id, bool block) _address = lo_address_new_from_url(_engine_url.c_str()); if (_address == NULL) { - cerr << "Aborting: Unable to connect to " << _engine_url << endl; + LOG(error) << "Unable to connect to " << _engine_url << endl; exit(EXIT_FAILURE); } - cout << "[OSCEngineSender] Attempting to contact engine at " << _engine_url << " ..." << endl; + LOG(info) << "Attempting to contact engine at " << _engine_url << " ..." << endl; _id = ping_id; this->ping(); diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 6c64735d..7949f316 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -15,7 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <iostream> #include "raul/TableImpl.hpp" #include "interface/GraphObject.hpp" #include "ObjectModel.hpp" diff --git a/src/client/ObjectModel.hpp b/src/client/ObjectModel.hpp index 9b0544f6..79ae1fe9 100644 --- a/src/client/ObjectModel.hpp +++ b/src/client/ObjectModel.hpp @@ -19,7 +19,6 @@ #define OBJECTMODEL_H #include <cstdlib> -#include <iostream> #include <algorithm> #include <cassert> #include <boost/utility.hpp> diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp index 25255f06..376a6a68 100644 --- a/src/client/PatchModel.cpp +++ b/src/client/PatchModel.cpp @@ -16,7 +16,7 @@ */ #include <cassert> -#include <iostream> +#include "raul/log.hpp" #include "PatchModel.hpp" #include "NodeModel.hpp" #include "ConnectionModel.hpp" @@ -155,7 +155,7 @@ PatchModel::remove_connection(const Path& src_port_path, const Path& dst_port_pa } } - cerr << "[PatchModel::remove_connection] WARNING: Failed to find connection " << + warn << "[PatchModel::remove_connection] Failed to find connection " << src_port_path << " -> " << dst_port_path << endl; } diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp index b9407334..01cc14dc 100644 --- a/src/client/PluginModel.hpp +++ b/src/client/PluginModel.hpp @@ -19,7 +19,6 @@ #define PLUGINMODEL_H #include "ingen-config.h" -#include <iostream> #include "raul/SharedPtr.hpp" #include "redlandmm/World.hpp" #ifdef HAVE_SLV2 diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index bb10b3a6..f9882be1 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <iostream> +#include "raul/log.hpp" #include "event.lv2/event-helpers.h" #include "object.lv2/object.h" #include "shared/LV2Features.hpp" @@ -40,8 +40,7 @@ lv2_ui_write(LV2UI_Controller controller, uint32_t format, const void* buffer) { - /* - cerr << "lv2_ui_write (format " << format << "):" << endl; + /*fprintf(stderr, "lv2_ui_write (format %u):\n", format); fprintf(stderr, "RAW:\n"); for (uint32_t i=0; i < buffer_size; ++i) { unsigned char byte = ((unsigned char*)buffer)[i]; @@ -50,8 +49,7 @@ lv2_ui_write(LV2UI_Controller controller, else fprintf(stderr, "%2X ", ((unsigned char*)buffer)[i]); } - fprintf(stderr, "\n"); - */ + fprintf(stderr, "\n");*/ PluginUI* ui = (PluginUI*)controller; @@ -80,7 +78,7 @@ lv2_ui_write(LV2UI_Controller controller, ui->world()->engine->set_port_value(port->path(), Atom("lv2midi:MidiEvent", ev->size, data)); } else { - cerr << "WARNING: Unable to send event type " << ev->type << + warn << "Unable to send event type " << ev->type << " over OSC, ignoring event" << endl; } @@ -94,7 +92,7 @@ lv2_ui_write(LV2UI_Controller controller, ui->world()->engine->set_port_value(port->path(), val); } else { - cerr << "WARNING: Unknown value format " << format + warn << "Unknown value format " << format << ", either plugin " << ui->node()->plugin()->uri() << " is broken" << " or this is an Ingen bug" << endl; } @@ -142,7 +140,7 @@ PluginUI::create(Ingen::Shared::World* world, } if (ui) { - cout << "Found GTK Plugin UI: " << slv2_ui_get_uri(ui) << endl; + info << "Found GTK Plugin UI: " << slv2_ui_get_uri(ui) << endl; ret = SharedPtr<PluginUI>(new PluginUI(world, node)); ret->_features = world->lv2_features->lv2_features(node.get()); SLV2UIInstance inst = slv2_ui_instantiate( @@ -151,7 +149,7 @@ PluginUI::create(Ingen::Shared::World* world, if (inst) { ret->set_instance(inst); } else { - cerr << "ERROR: Failed to instantiate Plugin UI" << endl; + error << "Failed to instantiate Plugin UI" << endl; ret = SharedPtr<PluginUI>(); } } diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp index 34f909d0..dbf82f1a 100644 --- a/src/client/PortModel.hpp +++ b/src/client/PortModel.hpp @@ -19,9 +19,9 @@ #define PORTMODEL_H #include <cstdlib> -#include <iostream> #include <string> #include <sigc++/sigc++.h> +#include "raul/log.hpp" #include "raul/SharedPtr.hpp" #include "interface/Port.hpp" #include "ObjectModel.hpp" @@ -87,7 +87,7 @@ private: , _connections(0) { if (_type == Shared::PortType::UNKNOWN) - std::cerr << "[PortModel] Warning: Unknown port type" << std::endl; + Raul::warn << "[PortModel] Unknown port type" << std::endl; } void add_child(SharedPtr<ObjectModel> c) { throw; } diff --git a/src/client/ThreadedSigClientInterface.cpp b/src/client/ThreadedSigClientInterface.cpp index 8741ecf7..56eeddf6 100644 --- a/src/client/ThreadedSigClientInterface.cpp +++ b/src/client/ThreadedSigClientInterface.cpp @@ -15,13 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <iostream> +#include "raul/log.hpp" #include "common/interface/Patch.hpp" #include "common/interface/Plugin.hpp" #include "common/interface/Port.hpp" #include "ThreadedSigClientInterface.hpp" using namespace std; +using namespace Raul; namespace Ingen { namespace Client { @@ -38,11 +39,11 @@ ThreadedSigClientInterface::push_sig(Closure ev) while (!success) { success = _sigs.push(ev); if (!success) { - cerr << "WARNING: Client event queue full. Waiting..." << endl; + warn << "Client event queue full. Waiting..." << endl; _mutex.lock(); _cond.wait(_mutex); _mutex.unlock(); - cerr << "Queue drained, continuing" << endl; + warn << "Queue drained, continuing" << endl; } } } |