From a1d05935a577d5d8a7d079b6f14a149e491a9543 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Fri, 12 Apr 2024 11:55:49 +0100 Subject: [PATCH 3/3] Strip out the glog example --- CMakeLists.txt | 1 - debian/control | 1 - doc/sphinx/.readthedocs.yaml | 1 - examples/mir_demo_server/CMakeLists.txt | 3 - examples/mir_demo_server/glog_logger.cpp | 72 ------------------- examples/mir_demo_server/glog_logger.h | 39 ---------- examples/mir_demo_server/server_example.cpp | 2 - .../server_example_log_options.cpp | 70 ------------------ .../server_example_log_options.h | 30 -------- snap/snapcraft.yaml | 2 - spread/build/alpine/task.yaml | 1 - spread/build/fedora/task.yaml | 1 - src/platform/symbols.map | 4 -- 13 files changed, 227 deletions(-) delete mode 100644 examples/mir_demo_server/glog_logger.cpp delete mode 100644 examples/mir_demo_server/glog_logger.h delete mode 100644 examples/mir_demo_server/server_example_log_options.cpp delete mode 100644 examples/mir_demo_server/server_example_log_options.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 62873f9936..82ef2a5aec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -265,7 +265,6 @@ pkg_check_modules(EGL REQUIRED IMPORTED_TARGET egl) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0 gio-unix-2.0) pkg_check_modules(GLESv2 REQUIRED IMPORTED_TARGET glesv2) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) -pkg_check_modules(GLog REQUIRED IMPORTED_TARGET libglog) pkg_check_modules(LIBINPUT REQUIRED IMPORTED_TARGET libinput>=1.1) pkg_check_modules(LTTNG_UST REQUIRED IMPORTED_TARGET lttng-ust>=2.9) pkg_check_modules(UDEV REQUIRED IMPORTED_TARGET libudev) diff --git a/doc/sphinx/.readthedocs.yaml b/doc/sphinx/.readthedocs.yaml index b245ffc26e..0f4ddbd0c6 100644 --- a/doc/sphinx/.readthedocs.yaml +++ b/doc/sphinx/.readthedocs.yaml @@ -24,7 +24,6 @@ build: - libglib2.0-dev - libgles2-mesa-dev - libglm-dev - - libgoogle-glog-dev - libinput-dev - liblttng-ust-dev - libwayland-dev diff --git a/examples/mir_demo_server/CMakeLists.txt b/examples/mir_demo_server/CMakeLists.txt index 38df174421..ae1c169337 100644 --- a/examples/mir_demo_server/CMakeLists.txt +++ b/examples/mir_demo_server/CMakeLists.txt @@ -1,7 +1,6 @@ add_library(exampleserverconfig STATIC server_example_input_device_config.cpp server_example_input_event_filter.cpp - server_example_log_options.cpp server_example_input_filter.cpp ) @@ -20,13 +19,11 @@ include_directories( mir_add_wrapped_executable(mir_demo_server server_example.cpp - glog_logger.cpp server_example_test_client.cpp ) target_link_libraries(mir_demo_server example-shell-lib exampleserverconfig - PkgConfig::GLog Boost::system ) diff --git a/examples/mir_demo_server/glog_logger.cpp b/examples/mir_demo_server/glog_logger.cpp deleted file mode 100644 index dfd817c4e9..0000000000 --- a/examples/mir_demo_server/glog_logger.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright © Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 or 3 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "glog_logger.h" - -#include - -#include - -namespace ml=mir::logging; - -namespace -{ -std::once_flag init_flag; -std::once_flag shutdown_flag; - -struct google_glog_guard_t -{ - google_glog_guard_t(const char* argv0) - { - std::call_once(init_flag, google::InitGoogleLogging, argv0); - } - - ~google_glog_guard_t() - { - std::call_once(shutdown_flag, google::ShutdownGoogleLogging); - } -}; -} - - -mir::examples::GlogLogger::GlogLogger( - const char* argv0, - int stderrthreshold, - int minloglevel, - std::string const& log_dir) -{ - FLAGS_stderrthreshold = stderrthreshold; - FLAGS_minloglevel = minloglevel; - FLAGS_log_dir = log_dir; - - static google_glog_guard_t guard(argv0); -} - -void mir::examples::GlogLogger::log(ml::Severity severity, std::string const& message, std::string const& component) -{ - static int glog_level[] = - { - google::GLOG_FATAL, // critical = 0, - google::GLOG_ERROR, // error = 1, - google::GLOG_WARNING, // warning = 2, - google::GLOG_INFO, // informational = 3, - google::GLOG_INFO, // debug = 4 - }; - - // Since we're not collecting __FILE__ or __LINE__ this is misleading - google::LogMessage(__FILE__, __LINE__, glog_level[static_cast(severity)]).stream() - << '[' << component << "] " << message; -} diff --git a/examples/mir_demo_server/glog_logger.h b/examples/mir_demo_server/glog_logger.h deleted file mode 100644 index eb53690260..0000000000 --- a/examples/mir_demo_server/glog_logger.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright © Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 or 3 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "mir/logging/logger.h" - -namespace mir -{ -namespace examples -{ -class GlogLogger : public logging::Logger -{ -public: - GlogLogger( - char const* argv0, - int stderrthreshold, - int minloglevel, - std::string const& log_dir); - -private: - virtual void log( - mir::logging::Severity severity, - std::string const& message, - std::string const& component) override; -}; -} -} diff --git a/examples/mir_demo_server/server_example.cpp b/examples/mir_demo_server/server_example.cpp index 195f0c2f6d..2517054eca 100644 --- a/examples/mir_demo_server/server_example.cpp +++ b/examples/mir_demo_server/server_example.cpp @@ -14,7 +14,6 @@ * along with this program. If not, see . */ -#include "server_example_log_options.h" #include "server_example_input_event_filter.h" #include "server_example_input_filter.h" #include "server_example_test_client.h" @@ -129,7 +128,6 @@ try auto const server_exit_status = runner.run_with({ // example options for display layout, logging and timeout miral::display_configuration_options, - me::add_glog_options_to, miral::X11Support{}, miral::WaylandExtensions{} .enable(miral::WaylandExtensions::zwlr_layer_shell_v1) diff --git a/examples/mir_demo_server/server_example_log_options.cpp b/examples/mir_demo_server/server_example_log_options.cpp deleted file mode 100644 index 95911ade06..0000000000 --- a/examples/mir_demo_server/server_example_log_options.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright © Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 or 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "server_example_log_options.h" -#include "glog_logger.h" - -#include "mir/server.h" -#include "mir/options/option.h" - -namespace me = mir::examples; -namespace ml = mir::logging; - -///\example server_example_log_options.cpp -/// Demonstrate adding custom logging options to a server (using glog as the example) -void me::add_glog_options_to(mir::Server& server) -{ - static char const* const glog = "glog"; - static char const* const glog_stderrthreshold = "glog-stderrthreshold"; - static char const* const glog_minloglevel = "glog-minloglevel"; - static char const* const glog_log_dir = "glog-log-dir"; - - static int const glog_stderrthreshold_default = 2; - static int const glog_minloglevel_default = 0; - static char const* const glog_log_dir_default = ""; - - server.add_configuration_option(glog, "Use google::GLog for logging", mir::OptionType::null); - server.add_configuration_option(glog_stderrthreshold, - "Copy log messages at or above this level " - "to stderr in addition to logfiles. The numbers " - "of severity levels INFO, WARNING, ERROR, and " - "FATAL are 0, 1, 2, and 3, respectively.", - glog_stderrthreshold_default); - server.add_configuration_option(glog_minloglevel, - "Log messages at or above this level. The numbers " - "of severity levels INFO, WARNING, ERROR, and " - "FATAL are 0, 1, 2, and 3, respectively.", - glog_minloglevel_default); - server.add_configuration_option(glog_log_dir, "logfiles are written into this directory.", glog_log_dir_default); - - server.override_the_logger( - [&]() -> std::shared_ptr - { - if (server.get_options()->is_set(glog)) - { - return std::make_shared( - "mir", - server.get_options()->get(glog_stderrthreshold), - server.get_options()->get(glog_minloglevel), - server.get_options()->get(glog_log_dir)); - } - else - { - return std::shared_ptr{}; - } - }); -} - diff --git a/examples/mir_demo_server/server_example_log_options.h b/examples/mir_demo_server/server_example_log_options.h deleted file mode 100644 index 88c374d42f..0000000000 --- a/examples/mir_demo_server/server_example_log_options.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright © Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 or 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MIR_EXAMPLES_EXAMPLE_LOG_OPTIONS_H_ -#define MIR_EXAMPLES_EXAMPLE_LOG_OPTIONS_H_ - -namespace mir -{ -class Server; - -namespace examples -{ -void add_glog_options_to(Server& server); -} -} - -#endif /* MIR_EXAMPLES_EXAMPLE_LOG_OPTIONS_H_ */ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index e1955c4583..3f1e1b8f59 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -33,7 +33,6 @@ parts: - libfreetype6-dev - libgbm-dev - libglm-dev - - libgoogle-glog-dev - libgtest-dev - libinput-dev - liblttng-ust-dev @@ -65,7 +64,6 @@ parts: - libgles2 - libglibmm-2.4-1v5 - libglvnd0 - - libgoogle-glog0v5 - libgudev-1.0-0 - libicu70 - libinput10 diff --git a/src/platform/symbols.map b/src/platform/symbols.map index 0187aed279..528bd7e313 100644 --- a/src/platform/symbols.map +++ b/src/platform/symbols.map @@ -104,10 +104,6 @@ MIRPLATFORM_2.5 { mir::options::enable_input_opt*; mir::options::enable_key_repeat_opt*; mir::options::fatal_except_opt*; - mir::options::glog*; - mir::options::glog_log_dir*; - mir::options::glog_minloglevel*; - mir::options::glog_stderrthreshold*; mir::options::input_report_opt*; mir::options::log_opt_value*; mir::options::logind_console; -- 2.45.2