diff options
author | David Robillard <d@drobilla.net> | 2019-03-08 12:38:19 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-03-09 00:43:43 +0100 |
commit | 532af2452bac2cdd0e2732ad145fdc2b141a4afc (patch) | |
tree | 0b078c37a137ef0da3a1e76bc150e99f65f6d7dc /src/client | |
parent | 6bb3c48972d172fec244afae08a905e2246d9cda (diff) | |
download | ingen-532af2452bac2cdd0e2732ad145fdc2b141a4afc.tar.gz ingen-532af2452bac2cdd0e2732ad145fdc2b141a4afc.tar.bz2 ingen-532af2452bac2cdd0e2732ad145fdc2b141a4afc.zip |
Localise dependency on boost::format and improve logging API
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/ClientStore.cpp | 43 | ||||
-rw-r--r-- | src/client/PluginUI.cpp | 28 |
2 files changed, 34 insertions, 37 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index ad3b3c0d..1f71bf61 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -70,7 +70,7 @@ ClientStore::add_object(SPtr<ObjectModel> object) (*this)[object->path()] = object; _signal_new_object.emit(object); } else { - _log.error(fmt("Object %1% with no parent\n") % object->path()); + _log.error("Object %1% with no parent\n", object->path()); } } else { (*this)[object->path()] = object; @@ -252,14 +252,14 @@ ClientStore::operator()(const Put& msg) const Iterator l = properties.find(_uris.rdfs_label); SPtr<PluginModel> plug; if (p == properties.end()) { - _log.error(fmt("Preset <%1%> with no plugin\n") % uri.c_str()); + _log.error("Preset <%1%> with no plugin\n", uri.c_str()); } else if (l == properties.end()) { - _log.error(fmt("Preset <%1%> with no label\n") % uri.c_str()); + _log.error("Preset <%1%> with no label\n", uri.c_str()); } else if (l->second.type() != _uris.forge.String) { - _log.error(fmt("Preset <%1%> label is not a string\n") % uri.c_str()); + _log.error("Preset <%1%> label is not a string\n", uri.c_str()); } else if (!(plug = _plugin(p->second))) { - _log.error(fmt("Preset <%1%> for unknown plugin %2%\n") - % uri.c_str() % _uris.forge.str(p->second, true)); + _log.error("Preset <%1%> for unknown plugin %2%\n", + uri.c_str(), _uris.forge.str(p->second, true)); } else { plug->add_preset(uri, l->second.ptr<char>()); } @@ -274,8 +274,7 @@ ClientStore::operator()(const Put& msg) } if (!uri_is_path(uri)) { - _log.error(fmt("Put for unknown subject <%1%>\n") - % uri.c_str()); + _log.error("Put for unknown subject <%1%>\n", uri.c_str()); return; } @@ -315,7 +314,7 @@ ClientStore::operator()(const Put& msg) bm->set_properties(properties); add_object(bm); } else { - _log.warn(fmt("Block %1% has no prototype\n") % path.c_str()); + _log.warn("Block %1% has no prototype\n", path.c_str()); } } else if (is_port) { PortModel::Direction pdir = (is_output) @@ -331,7 +330,7 @@ ClientStore::operator()(const Put& msg) p->set_properties(properties); add_object(p); } else { - _log.warn(fmt("Ignoring %1% of unknown type\n") % path.c_str()); + _log.warn("Ignoring %1% of unknown type\n", path.c_str()); } } @@ -345,8 +344,7 @@ ClientStore::operator()(const Delta& msg) } if (!uri_is_path(uri)) { - _log.error(fmt("Delta for unknown subject <%1%>\n") - % uri.c_str()); + _log.error("Delta for unknown subject <%1%>\n", uri.c_str()); return; } @@ -357,7 +355,7 @@ ClientStore::operator()(const Delta& msg) obj->remove_properties(msg.remove); obj->add_properties(msg.add); } else { - _log.warn(fmt("Failed to find object `%1%'\n") % path.c_str()); + _log.warn("Failed to find object `%1%'\n", path.c_str()); } } @@ -369,8 +367,8 @@ ClientStore::operator()(const SetProperty& msg) const auto& value = msg.value; if (subject_uri == URI("ingen:/engine")) { - _log.info(fmt("Engine property <%1%> = %2%\n") - % predicate.c_str() % _uris.forge.str(value, false)); + _log.info("Engine property <%1%> = %2%\n", + predicate.c_str(), _uris.forge.str(value, false)); return; } SPtr<Resource> subject = _resource(subject_uri); @@ -387,8 +385,8 @@ ClientStore::operator()(const SetProperty& msg) if (plugin) { plugin->set_property(predicate, value); } else if (predicate != _uris.ingen_activity) { - _log.warn(fmt("Property <%1%> for unknown object %2%\n") - % predicate.c_str() % subject_uri.c_str()); + _log.warn("Property <%1%> for unknown object %2%\n", + predicate.c_str(), subject_uri.c_str()); } } } @@ -416,8 +414,8 @@ ClientStore::connection_graph(const Raul::Path& tail_path, } if (!graph) { - _log.error(fmt("Unable to find graph for arc %1% => %2%\n") - % tail_path % head_path); + _log.error("Unable to find graph for arc %1% => %2%\n", + tail_path, head_path); } return graph; @@ -436,8 +434,7 @@ ClientStore::attempt_connection(const Raul::Path& tail_path, graph->add_arc(arc); return true; } else { - _log.warn(fmt("Failed to connect %1% => %2%\n") - % tail_path % head_path); + _log.warn("Failed to connect %1% => %2%\n", tail_path, head_path); return false; } } @@ -466,8 +463,8 @@ ClientStore::operator()(const DisconnectAll& msg) SPtr<ObjectModel> object = _object(msg.path); if (!graph || !object) { - _log.error(fmt("Bad disconnect all notification %1% in %2%\n") - % msg.path % msg.graph); + _log.error("Bad disconnect all notification %1% in %2%\n", + msg.path, msg.graph); return; } diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 5f954b85..c093ad47 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -32,9 +32,9 @@ static SPtr<const PortModel> get_port(PluginUI* ui, uint32_t port_index) { if (port_index >= ui->block()->ports().size()) { - ui->world().log().error( - fmt("%1% UI tried to access invalid port %2%\n") - % ui->block()->plugin()->uri().c_str() % port_index); + ui->world().log().error("%1% UI tried to access invalid port %2%\n", + ui->block()->plugin()->uri().c_str(), + port_index); return SPtr<const PortModel>(); } return ui->block()->ports()[port_index]; @@ -58,8 +58,8 @@ lv2_ui_write(SuilController controller, if (format == 0) { if (buffer_size != 4) { ui->world().log().error( - fmt("%1% UI wrote corrupt float with bad size\n") - % ui->block()->plugin()->uri().c_str()); + "%1% UI wrote corrupt float with bad size\n", + ui->block()->plugin()->uri().c_str()); return; } const float value = *(const float*)buffer; @@ -83,9 +83,9 @@ lv2_ui_write(SuilController controller, val, Resource::Graph::DEFAULT); } else { - ui->world().log().warn( - fmt("Unknown value format %1% from LV2 UI\n") - % format % ui->block()->plugin()->uri().c_str()); + ui->world().log().warn("Unknown value format %1% from LV2 UI\n", + format, + ui->block()->plugin()->uri().c_str()); } } @@ -238,14 +238,14 @@ PluginUI::instantiate() const LilvNode* sym = lilv_world_get(lworld, note, uris.lv2_symbol, nullptr); const LilvNode* plug = lilv_world_get(lworld, note, ui_plugin, nullptr); if (!plug) { - _world.log().error(fmt("%1% UI %2% notification missing plugin\n") - % plugin_uri % lilv_node_as_string(_ui_node)); + _world.log().error("%1% UI %2% notification missing plugin\n", + plugin_uri, lilv_node_as_string(_ui_node)); } else if (!sym) { - _world.log().error(fmt("%1% UI %2% notification missing symbol\n") - % plugin_uri % lilv_node_as_string(_ui_node)); + _world.log().error("%1% UI %2% notification missing symbol\n", + plugin_uri, lilv_node_as_string(_ui_node)); } else if (!lilv_node_is_uri(plug)) { - _world.log().error(fmt("%1% UI %2% notification has non-URI plugin\n") - % plugin_uri % lilv_node_as_string(_ui_node)); + _world.log().error("%1% UI %2% notification has non-URI plugin\n", + plugin_uri, lilv_node_as_string(_ui_node)); } else if (!strcmp(lilv_node_as_uri(plug), plugin_uri.c_str())) { // Notification is valid and for this plugin uint32_t index = lv2_ui_port_index(this, lilv_node_as_string(sym)); |