From 51be97f9aa199d4df6548d949578b5d75898401b Mon Sep 17 00:00:00 2001 From: Lucas Lazare Date: Sat, 18 May 2019 19:44:45 -0400 Subject: [PATCH] Adding spdlog --- include/bar.hpp | 8 ++++---- include/modules/battery.hpp | 3 ++- include/modules/cpu.hpp | 4 +++- include/modules/custom.hpp | 2 +- meson.build | 2 ++ src/bar.cpp | 20 ++++++++++---------- src/client.cpp | 7 ++++--- src/main.cpp | 6 +++--- src/modules/battery.cpp | 3 ++- src/modules/cpu.cpp | 1 + src/modules/custom.cpp | 3 ++- src/modules/mpd.cpp | 24 ++++++++++++------------ src/modules/network.cpp | 8 ++++---- src/modules/sni/host.cpp | 13 +++++++------ src/modules/sni/item.cpp | 9 ++++----- src/modules/sni/tray.cpp | 3 +-- src/modules/sni/watcher.cpp | 7 +++---- src/modules/sway/mode.cpp | 7 ++++--- src/modules/sway/window.cpp | 7 ++++--- src/modules/sway/workspaces.cpp | 11 ++++++----- subprojects/spdlog.wrap | 10 ++++++++++ 21 files changed, 89 insertions(+), 69 deletions(-) create mode 100644 subprojects/spdlog.wrap diff --git a/include/bar.hpp b/include/bar.hpp index c4cd8148..a8b99819 100644 --- a/include/bar.hpp +++ b/include/bar.hpp @@ -38,13 +38,13 @@ class Bar { bool vertical = false; private: - static inline const std::string MIN_HEIGHT_MSG = + static constexpr const char* MIN_HEIGHT_MSG = "Requested height: {} exceeds the minimum height: {} required by the modules"; - static inline const std::string MIN_WIDTH_MSG = + static constexpr const char* MIN_WIDTH_MSG = "Requested width: {} exceeds the minimum width: {} required by the modules"; - static inline const std::string BAR_SIZE_MSG = + static constexpr const char* BAR_SIZE_MSG = "Bar configured (width: {}, height: {}) for output: {}"; - static inline const std::string SIZE_DEFINED = + static constexpr const char* SIZE_DEFINED = "{} size is defined in the config file so it will stay like that"; static void layerSurfaceHandleConfigure(void *, struct zwlr_layer_surface_v1 *, uint32_t, uint32_t, uint32_t); diff --git a/include/modules/battery.hpp b/include/modules/battery.hpp index 5f2290ee..e7a12883 100644 --- a/include/modules/battery.hpp +++ b/include/modules/battery.hpp @@ -9,7 +9,8 @@ #include #include #include -#include +#include +#include #include "ALabel.hpp" #include "util/sleeper_thread.hpp" diff --git a/include/modules/cpu.hpp b/include/modules/cpu.hpp index 5c17d3a4..ee44952e 100644 --- a/include/modules/cpu.hpp +++ b/include/modules/cpu.hpp @@ -3,9 +3,11 @@ #include #include #include -#include +#include #include #include +#include +#include #include "ALabel.hpp" #include "util/sleeper_thread.hpp" diff --git a/include/modules/custom.hpp b/include/modules/custom.hpp index 7ffac3d6..28169720 100644 --- a/include/modules/custom.hpp +++ b/include/modules/custom.hpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include "ALabel.hpp" #include "util/command.hpp" #include "util/json.hpp" diff --git a/meson.build b/meson.build index 8882e903..83a53cc9 100644 --- a/meson.build +++ b/meson.build @@ -48,6 +48,7 @@ add_global_link_arguments(cpp_link_args, language : 'cpp') thread_dep = dependency('threads') libinput = dependency('libinput') fmt = dependency('fmt', version : ['>=5.3.0'], fallback : ['fmt', 'fmt_dep']) +spdlog = dependency('spdlog', version : ['>=1.3.1'], fallback : ['spdlog', 'spdlog_dep']) wayland_client = dependency('wayland-client') wayland_cursor = dependency('wayland-cursor') wayland_protos = dependency('wayland-protocols') @@ -129,6 +130,7 @@ executable( client_protos, wayland_client, fmt, + spdlog, sigcpp, jsoncpp, libinput, diff --git a/src/bar.cpp b/src/bar.cpp index 09d7335c..a183c96a 100644 --- a/src/bar.cpp +++ b/src/bar.cpp @@ -1,4 +1,5 @@ #include "bar.hpp" +#include #include "client.hpp" #include "factory.hpp" @@ -114,7 +115,7 @@ void waybar::Bar::setMarginsAndZone(uint32_t height, uint32_t width) { .left = std::stoi(margins[3], nullptr, 10)}; } } catch (...) { - std::cerr << "Invalid margins: " + config["margin"].asString() << std::endl; + spdlog::warn("Invalid margins: {}", config["margin"].asString()); } } else if (config["margin"].isInt()) { auto gaps = config["margin"].asInt(); @@ -132,10 +133,10 @@ void waybar::Bar::onConfigure(GdkEventConfigure* ev) { if (ev->height > static_cast(height_)) { // Default minimal value if (height_ != 1) { - std::cout << fmt::format(MIN_HEIGHT_MSG, height_, ev->height) << std::endl; + spdlog::warn(MIN_HEIGHT_MSG, height_, ev->height); } if (config["height"].isUInt()) { - std::cout << fmt::format(SIZE_DEFINED, "Height") << std::endl; + spdlog::info(SIZE_DEFINED, "Height"); } else { tmp_height = ev->height; } @@ -143,10 +144,10 @@ void waybar::Bar::onConfigure(GdkEventConfigure* ev) { if (ev->width > static_cast(width_)) { // Default minimal value if (width_ != 1) { - std::cout << fmt::format(MIN_WIDTH_MSG, width_, ev->width) << std::endl; + spdlog::warn(MIN_WIDTH_MSG, width_, ev->width); } if (config["width"].isUInt()) { - std::cout << fmt::format(SIZE_DEFINED, "Width") << std::endl; + spdlog::info(SIZE_DEFINED, "Width"); } else { tmp_width = ev->width; } @@ -227,11 +228,10 @@ void waybar::Bar::layerSurfaceHandleConfigure(void* data, struct zwlr_layer_surf o->window.resize(o->width_, o->height_); auto zone = o->vertical ? width + o->margins_.right : height + o->margins_.bottom; zwlr_layer_surface_v1_set_exclusive_zone(o->layer_surface, zone); - std::cout << fmt::format(BAR_SIZE_MSG, + spdlog::info(BAR_SIZE_MSG, o->width_ == 1 ? "auto" : std::to_string(o->width_), o->height_ == 1 ? "auto" : std::to_string(o->height_), - o->output->name) - << std::endl; + o->output->name); wl_surface_commit(o->surface); } zwlr_layer_surface_v1_ack_configure(surface, serial); @@ -277,12 +277,12 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos) { try { module->update(); } catch (const std::exception& e) { - std::cerr << name.asString() + ": " + e.what() << std::endl; + spdlog::error("{}: {}", name.asString(), e.what()); } }); }); } catch (const std::exception& e) { - std::cerr << e.what() << std::endl; + spdlog::warn("module {}: {}", name.asString(), e.what()); } } } diff --git a/src/client.cpp b/src/client.cpp index b927684b..efdcee6c 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1,6 +1,7 @@ #include "client.hpp" #include #include +#include #include "util/clara.hpp" #include "util/json.hpp" @@ -55,7 +56,7 @@ void waybar::Client::handleGlobalRemove(void * data, struct wl_registry * /*re auto output_name = (*it)->output->name; (*it)->window.close(); it = client->bars.erase(it); - std::cout << "Bar removed from output: " + output_name << std::endl; + spdlog::info("Bar removed from output: {}", output_name); } else { ++it; } @@ -191,7 +192,7 @@ void waybar::Client::setupConfigs(const std::string &config, const std::string & if (css_file_.empty() || config_file_.empty()) { throw std::runtime_error("Missing required resources files"); } - std::cout << "Resources files: " + config_file_ + ", " + css_file_ << std::endl; + spdlog::info("Resources files: {}, {}", config_file_, css_file_); } auto waybar::Client::setupConfig() -> void { @@ -249,7 +250,7 @@ int waybar::Client::main(int argc, char *argv[]) { clara::detail::Opt(bar_id, "id")["-b"]["--bar"]("Bar id"); auto res = cli.parse(clara::detail::Args(argc, argv)); if (!res) { - std::cerr << "Error in command line: " << res.errorMessage() << std::endl; + spdlog::error("Error in command line: {}", res.errorMessage()); return 1; } if (show_help) { diff --git a/src/main.cpp b/src/main.cpp index 59471aac..f066cf85 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include "client.hpp" int main(int argc, char* argv[]) { @@ -23,10 +23,10 @@ int main(int argc, char* argv[]) { delete client; return ret; } catch (const std::exception& e) { - std::cerr << e.what() << std::endl; + spdlog::error("{}", e.what()); return 1; } catch (const Glib::Exception& e) { - std::cerr << e.what().c_str() << std::endl; + spdlog::error("{}", static_cast(e.what())); return 1; } } diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index 2c1cc112..735829c2 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -1,4 +1,5 @@ #include "modules/battery.hpp" +#include waybar::modules::Battery::Battery(const std::string& id, const Json::Value& config) : ALabel(config, "{capacity}%", 60) { @@ -103,7 +104,7 @@ const std::tuple waybar::modules::Battery::getIn uint16_t capacity = total / batteries_.size(); return {capacity, total_current, status}; } catch (const std::exception& e) { - std::cerr << e.what() << std::endl; + spdlog::error("Battery: {}", e.what()); return {0, 0, "Unknown"}; } } diff --git a/src/modules/cpu.cpp b/src/modules/cpu.cpp index 7c75cb90..280212c4 100644 --- a/src/modules/cpu.cpp +++ b/src/modules/cpu.cpp @@ -1,4 +1,5 @@ #include "modules/cpu.hpp" +#include waybar::modules::Cpu::Cpu(const std::string& id, const Json::Value& config) : ALabel(config, "{usage}%", 10) { diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index de584476..e974a542 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -1,4 +1,5 @@ #include "modules/custom.hpp" +#include waybar::modules::Custom::Custom(const std::string& name, const Json::Value& config) : ALabel(config, "{}"), name_(name), fp_(nullptr), pid_(-1) { @@ -58,7 +59,7 @@ void waybar::modules::Custom::continuousWorker() { if (exit_code != 0) { output_ = {exit_code, ""}; dp.emit(); - std::cerr << name_ + " just stopped unexpectedly, is it endless?" << std::endl; + spdlog::error("{} stopped unexpectedly, is it endless?", name_); } return; } diff --git a/src/modules/mpd.cpp b/src/modules/mpd.cpp index b94eea91..f0726745 100644 --- a/src/modules/mpd.cpp +++ b/src/modules/mpd.cpp @@ -1,7 +1,7 @@ #include "modules/mpd.hpp" #include -#include +#include waybar::modules::MPD::MPD(const std::string& id, const Json::Value& config) : ALabel(config, "{album} - {artist} - {title}", 5), @@ -14,11 +14,11 @@ waybar::modules::MPD::MPD(const std::string& id, const Json::Value& config) status_(nullptr, &mpd_status_free), song_(nullptr, &mpd_song_free) { if (!config_["port"].isNull() && !config_["port"].isUInt()) { - std::cerr << module_name_ << ": `port` configuration should be an unsigned int" << std::endl; + spdlog::warn("{}: `port` configuration should be an unsigned int", module_name_); } if (!config_["timeout"].isNull() && !config_["timeout"].isUInt()) { - std::cerr << module_name_ << ": `timeout` configuration should be an unsigned int" << std::endl; + spdlog::warn("{}: `timeout` configuration should be an unsigned int", module_name_); } label_.set_name("mpd"); @@ -28,7 +28,7 @@ waybar::modules::MPD::MPD(const std::string& id, const Json::Value& config) if (!config["server"].isNull()) { if (!config_["server"].isString()) { - std::cerr << module_name_ << "`server` configuration should be a string" << std::endl; + spdlog::warn("{}:`server` configuration should be a string", module_name_); } server_ = config["server"].asCString(); } @@ -51,7 +51,7 @@ auto waybar::modules::MPD::update() -> void { periodic_updater().detach(); } } catch (const std::exception& e) { - std::cerr << module_name_ + ": " + e.what() << std::endl; + spdlog::error("{}: {}", module_name_, e.what()); state_ = MPD_STATE_UNKNOWN; } } @@ -72,7 +72,7 @@ std::thread waybar::modules::MPD::event_listener() { dp.emit(); } } catch (const std::exception& e) { - std::cerr << module_name_ + ": " + e.what() << std::endl; + spdlog::warn("{}: {}", module_name_, e.what()); } } }); @@ -206,12 +206,12 @@ std::string waybar::modules::MPD::getStateIcon() { } if (connection_ == nullptr) { - std::cerr << module_name_ << ": Trying to fetch state icon while disconnected" << std::endl; + spdlog::warn("{}: Trying to fetch state icon while disconnected", module_name_ ) return ""; } if (stopped()) { - std::cerr << module_name_ << ": Trying to fetch state icon while stopped" << std::endl; + spdlog::warn("{}: Trying to fetch state icon while stopped", module_name_); return ""; } @@ -228,7 +228,7 @@ std::string waybar::modules::MPD::getOptionIcon(std::string optionName, bool act } if (connection_ == nullptr) { - std::cerr << module_name_ << ": Trying to fetch option icon while disconnected" << std::endl; + spdlog::warn("{}: Trying to fetch option icon while disconnected", module_name); return ""; } @@ -251,7 +251,7 @@ void waybar::modules::MPD::tryConnect() { unique_connection(mpd_connection_new(server_, port_, timeout_), &mpd_connection_free); if (connection_ == nullptr || alternate_connection_ == nullptr) { - std::cerr << module_name_ << ": Failed to connect to MPD" << std::endl; + spdlog::error("{}: Failed to connect to MPD", module_name_); connection_.reset(); alternate_connection_.reset(); return; @@ -259,9 +259,9 @@ void waybar::modules::MPD::tryConnect() { try { checkErrors(connection_.get()); - std::cerr << module_name_ << ": Connected to MPD" << std::endl; + spdlog::info("{}: Connected to MPD", module_name_); } catch (std::runtime_error& e) { - std::cerr << module_name_ << ": Failed to connect to MPD: " << e.what() << std::endl; + spdlog::error("{}: Failed to connect to MPD: {}", module_name_, e.what()); connection_.reset(); alternate_connection_.reset(); } diff --git a/src/modules/network.cpp b/src/modules/network.cpp index d75d83a5..cde08f5c 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -1,7 +1,7 @@ #include "modules/network.hpp" +#include #include #include -#include namespace { @@ -13,7 +13,7 @@ namespace { std::ifstream netstat(NETSTAT_FILE); std::optional read_netstat(std::string_view category, std::string_view key) { if (!netstat) { - std::cerr << "Failed to open netstat file " << NETSTAT_FILE << '\n' << std::flush; + spdlog::warn("Failed to open netstat file {}", NETSTAT_FILE); return {}; } netstat.seekg(std::ios_base::beg); @@ -28,7 +28,7 @@ namespace { std::string read; while (std::getline(netstat, read) && !starts_with(read, category)); if (!starts_with(read, category)) { - std::cerr << "Category '" << category << "' not found in netstat file " << NETSTAT_FILE << '\n' << std::flush; + spdlog::warn("Category '{}' not found in netstat file {}", category, NETSTAT_FILE); return {}; } @@ -52,7 +52,7 @@ namespace { } if (r_it == read.end() && k_it != key.end()) { - std::cerr << "Key '" << key << "' not found in category '" << category << "' of netstat file " << NETSTAT_FILE << '\n' << std::flush; + spdlog::warn("Key '{}' not found in category '{}' of netstat file {}", key, category, NETSTAT_FILE); return {}; } diff --git a/src/modules/sni/host.cpp b/src/modules/sni/host.cpp index 62a68a2e..015f756b 100644 --- a/src/modules/sni/host.cpp +++ b/src/modules/sni/host.cpp @@ -1,5 +1,6 @@ #include "modules/sni/host.hpp" -#include +#include +#include namespace waybar::modules::SNI { @@ -63,14 +64,14 @@ void Host::proxyReady(GObject* src, GAsyncResult* res, gpointer data) { GError* error = nullptr; SnWatcher* watcher = sn_watcher_proxy_new_finish(res, &error); if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - std::cerr << error->message << std::endl; + spdlog::error("Host: {}", error->message); g_error_free(error); return; } auto host = static_cast(data); host->watcher_ = watcher; if (error != nullptr) { - std::cerr << error->message << std::endl; + spdlog::error("Host: {}", error->message); g_error_free(error); return; } @@ -82,13 +83,13 @@ void Host::registerHost(GObject* src, GAsyncResult* res, gpointer data) { GError* error = nullptr; sn_watcher_call_register_host_finish(SN_WATCHER(src), res, &error); if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { - std::cerr << error->message << std::endl; + spdlog::error("Host: {}", error->message); g_error_free(error); return; } auto host = static_cast(data); if (error != nullptr) { - std::cerr << error->message << std::endl; + spdlog::error("Host: {}", error->message); g_error_free(error); return; } @@ -139,4 +140,4 @@ void Host::addRegisteredItem(std::string service) { } } -} // namespace waybar::modules::SNI \ No newline at end of file +} // namespace waybar::modules::SNI diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index 106b0611..f763758a 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -1,6 +1,6 @@ #include "modules/sni/item.hpp" #include -#include +#include namespace waybar::modules::SNI { @@ -47,8 +47,7 @@ void Item::proxyReady(Glib::RefPtr& result) { this->proxy_->signal_signal().connect(sigc::mem_fun(*this, &Item::onSignal)); if (this->id.empty() || this->category.empty() || this->status.empty()) { - std::cerr << "Invalid Status Notifier Item: " + this->bus_name + "," + this->object_path - << std::endl; + spdlog::error("Invalid Status Notifier Item: {}, {}", bus_name, object_path); return; } this->updateImage(); @@ -235,7 +234,7 @@ void Item::updateImage() { image.set(getIconByName(icon_name, icon_size)); } } catch (Glib::Error& e) { - std::cerr << "Exception: " << e.what() << std::endl; + spdlog::error("Item '{}': {}", id, static_cast(e.what())); } } else if (icon_pixmap) { // An icon extracted may be the wrong size for the tray @@ -321,4 +320,4 @@ bool Item::handleClick(GdkEventButton* const& ev) { return false; } -} // namespace waybar::modules::SNI \ No newline at end of file +} // namespace waybar::modules::SNI diff --git a/src/modules/sni/tray.cpp b/src/modules/sni/tray.cpp index 500df42f..81f8bb06 100644 --- a/src/modules/sni/tray.cpp +++ b/src/modules/sni/tray.cpp @@ -1,5 +1,4 @@ #include "modules/sni/tray.hpp" -#include namespace waybar::modules::SNI { @@ -39,4 +38,4 @@ auto Tray::update() -> void { Tray::operator Gtk::Widget&() { return box_; } -} \ No newline at end of file +} diff --git a/src/modules/sni/watcher.cpp b/src/modules/sni/watcher.cpp index 596a06d4..11815cd4 100644 --- a/src/modules/sni/watcher.cpp +++ b/src/modules/sni/watcher.cpp @@ -1,6 +1,5 @@ #include "modules/sni/watcher.hpp" - -#include +#include using namespace waybar::modules::SNI; @@ -34,7 +33,7 @@ void Watcher::busAcquired(const Glib::RefPtr& conn, Glib: if (error != nullptr) { // Don't print an error when a watcher is already present if (error->code != 2) { - std::cerr << error->message << std::endl; + spdlog::error("Watcher {}: {}", watcher_id_, error->message); // FIXME: watcher_id_ is neither actually used nor initialized AFAICT } g_error_free(error); return; @@ -193,4 +192,4 @@ void Watcher::updateRegisteredItems(SnWatcher* obj) { sn_watcher_set_registered_items(obj, items); g_variant_unref(variant); g_free(items); -} \ No newline at end of file +} diff --git a/src/modules/sway/mode.cpp b/src/modules/sway/mode.cpp index e908d708..e8746a2c 100644 --- a/src/modules/sway/mode.cpp +++ b/src/modules/sway/mode.cpp @@ -1,4 +1,5 @@ #include "modules/sway/mode.hpp" +#include namespace waybar::modules::sway { @@ -24,7 +25,7 @@ void Mode::onEvent(const struct Ipc::ipc_response& res) { } dp.emit(); } catch (const std::exception& e) { - std::cerr << "Mode: " << e.what() << std::endl; + spdlog::error("Mode: {}", e.what()); } } @@ -33,7 +34,7 @@ void Mode::worker() { try { ipc_.handleEvent(); } catch (const std::exception& e) { - std::cerr << "Mode: " << e.what() << std::endl; + spdlog::error("Mode: {}", e.what()); } }; } @@ -50,4 +51,4 @@ auto Mode::update() -> void { } } -} // namespace waybar::modules::sway \ No newline at end of file +} // namespace waybar::modules::sway diff --git a/src/modules/sway/window.cpp b/src/modules/sway/window.cpp index c17f5fea..2b04417f 100644 --- a/src/modules/sway/window.cpp +++ b/src/modules/sway/window.cpp @@ -1,4 +1,5 @@ #include "modules/sway/window.hpp" +#include namespace waybar::modules::sway { @@ -55,7 +56,7 @@ void Window::onCmd(const struct Ipc::ipc_response& res) { dp.emit(); } } catch (const std::exception& e) { - std::cerr << "Window: " << e.what() << std::endl; + spdlog::error("Window: {}", e.what()); } } @@ -64,7 +65,7 @@ void Window::worker() { try { ipc_.handleEvent(); } catch (const std::exception& e) { - std::cerr << "Window: " << e.what() << std::endl; + spdlog::error("Window: {}", e.what()); } }; } @@ -102,7 +103,7 @@ void Window::getTree() { try { ipc_.sendCmd(IPC_GET_TREE); } catch (const std::exception& e) { - std::cerr << e.what() << std::endl; + spdlog::error("Window: {}", e.what()); } } diff --git a/src/modules/sway/workspaces.cpp b/src/modules/sway/workspaces.cpp index 231b3363..6fbbfd5c 100644 --- a/src/modules/sway/workspaces.cpp +++ b/src/modules/sway/workspaces.cpp @@ -1,4 +1,5 @@ #include "modules/sway/workspaces.hpp" +#include namespace waybar::modules::sway { @@ -28,7 +29,7 @@ void Workspaces::onEvent(const struct Ipc::ipc_response &res) { try { ipc_.sendCmd(IPC_GET_WORKSPACES); } catch (const std::exception &e) { - std::cerr << "Workspaces: " << e.what() << std::endl; + spdlog::error("Workspaces: {}", e.what()); } } @@ -50,7 +51,7 @@ void Workspaces::onCmd(const struct Ipc::ipc_response &res) { dp.emit(); } } catch (const std::exception &e) { - std::cerr << "Workspaces: " << e.what() << std::endl; + spdlog::error("Workspaces: {}", e.what()); } } else { if (scrolling_) { @@ -64,7 +65,7 @@ void Workspaces::worker() { try { ipc_.handleEvent(); } catch (const std::exception &e) { - std::cerr << "Workspaces: " << e.what() << std::endl; + spdlog::error("Workspaces: {}", e.what()); } }; } @@ -139,7 +140,7 @@ Gtk::Button &Workspaces::addButton(const Json::Value &node) { try { ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\"", pair.first->first)); } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; + spdlog::error("Workspaces: {}", e.what()); } }); if (!config_["disable-scroll"].asBool()) { @@ -208,7 +209,7 @@ bool Workspaces::handleScroll(GdkEventScroll *e) { try { ipc_.sendCmd(IPC_COMMAND, fmt::format("workspace \"{}\"", name)); } catch (const std::exception &e) { - std::cerr << "Workspaces: " << e.what() << std::endl; + spdlog::error("Workspaces: {}", e.what()); } return true; } diff --git a/subprojects/spdlog.wrap b/subprojects/spdlog.wrap new file mode 100644 index 00000000..9dac4d8d --- /dev/null +++ b/subprojects/spdlog.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = spdlog-1.3.1 + +source_url = https://github.com/gabime/spdlog/archive/v1.3.1.tar.gz +source_filename = v1.3.1.tar.gz +source_hash = 160845266e94db1d4922ef755637f6901266731c4cb3b30b45bf41efa0e6ab70 + +patch_url = https://wrapdb.mesonbuild.com/v1/projects/spdlog/1.3.1/1/get_zip +patch_filename = spdlog-1.3.1-1-wrap.zip +patch_hash = 715a0229781019b853d409cc0bf891ee4b9d3a17bec0cf87f4ad30b28bbecc87