#pragma once #include #include #include #include namespace yams::cli { // Install before constructing the CLI: command callbacks and embedded startup // can emit diagnostics before parsed logging flags have been applied. // The stream must outlive the logger; production uses the process-owned stderr. inline void initializeCliLogging(std::ostream& diagnostics = std::cerr) { auto sink = std::make_shared(diagnostics, true); auto logger = std::make_shared("yams-cli", std::move(sink)); logger->set_level(spdlog::level::warn); logger->set_pattern("[%H:%M:%S] [%l] %v"); spdlog::set_default_logger(std::move(logger)); } } // namespace yams::cli