From 1f173fdd46ad9924b028c27b93a02d068f37a782 Mon Sep 17 00:00:00 2001 From: zhangyi1357 <34409786+zhangyi1357@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:53:25 +0800 Subject: [PATCH] feat: add startup info printing during initialization (#107) Include a method to print detailed startup information about the framework, enhancing user awareness of the version and providing relevant links for support. --- src/runtime/core/aimrt_core.cc | 22 ++++++++++++++++++++++ src/runtime/core/aimrt_core.h | 1 + src/runtime/core/util/version.h | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/runtime/core/aimrt_core.cc b/src/runtime/core/aimrt_core.cc index 61492303c..b17372e1b 100644 --- a/src/runtime/core/aimrt_core.cc +++ b/src/runtime/core/aimrt_core.cc @@ -25,6 +25,27 @@ AimRTCore::~AimRTCore() { hook_task_vec_array_.clear(); } +void AimRTCore::PrintStartupInfo() const { + constexpr const char* aimrt_info = R"( + ╔═══════════════════════════════════════════════════════════╗ + ║ ║ + ║ █████╗ ██╗███╗ ███╗██████╗ ████████╗ ║ + ║ ██╔══██╗██║████╗ ████║██╔══██╗╚══██╔══╝ ║ + ║ ███████║██║██╔████╔██║██████╔╝ ██║ ║ + ║ ██╔══██║██║██║╚██╔╝██║██╔══██╗ ██║ ║ + ║ ██║ ██║██║██║ ╚═╝ ██║██║ ██║ ██║ ║ + ║ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ║ + ║ ║ + ║ Modern High Performance Robotics Framework ║ + ║ Official Website: https://aimrt.org ║ + ║ Documentation: https://docs.aimrt.org ║ + ║ Version: v{:<32}║ + ╚═══════════════════════════════════════════════════════════╝ + )"; + constexpr const auto* version_str = util::GetAimRTVersion(); + AIMRT_INFO(aimrt_info, version_str); +} + void AimRTCore::Initialize(const Options& options) { EnterState(State::kPreInit); @@ -70,6 +91,7 @@ void AimRTCore::Initialize(const Options& options) { std::bind(&AimRTCore::GetExecutor, this, std::placeholders::_1)); logger_manager_.Initialize(configurator_manager_.GetAimRTOptionsNode("log")); SetCoreLogger(); + PrintStartupInfo(); EnterState(State::kPostInitLog); // Init allocator diff --git a/src/runtime/core/aimrt_core.h b/src/runtime/core/aimrt_core.h index 3f38a0e0b..bc1552505 100644 --- a/src/runtime/core/aimrt_core.h +++ b/src/runtime/core/aimrt_core.h @@ -214,6 +214,7 @@ class AimRTCore { void CheckCfgFile() const; void StartImpl(); void ShutdownImpl(); + void PrintStartupInfo() const; private: Options options_; diff --git a/src/runtime/core/util/version.h b/src/runtime/core/util/version.h index 79528b7d8..5d97e6b1f 100644 --- a/src/runtime/core/util/version.h +++ b/src/runtime/core/util/version.h @@ -5,7 +5,7 @@ namespace aimrt::runtime::core::util { -inline const char* GetAimRTVersion() { +constexpr const char* GetAimRTVersion() { return AIMRT_VERSION; } } // namespace aimrt::runtime::core::util