790{
791 spdlog::trace("Received message {}", line);
792
793
794 session->sendLine(line);
795
796 if (line.empty())
797 {
798 return true;
799 }
800
801
803 {
805 session->sendLine("OK");
806 return true;
809 return true;
811 session->sendLine("Default log mode enabled");
812 spdlog::set_level(spdlog::level::info);
813 return true;
815 session->sendLine("Disabling all logs");
816 spdlog::set_level(spdlog::level::off);
817 return true;
819 session->sendLine("Info log mode enabled");
820 spdlog::set_level(spdlog::level::info);
821 return true;
823 session->sendLine("Debug log mode enabled");
824 spdlog::set_level(spdlog::level::debug);
825 return true;
827 session->sendLine("Trace log mode enabled");
828 spdlog::set_level(spdlog::level::trace);
829 return true;
831 session->sendLine("pong");
832 return true;
834 session->sendLine(PROJECT_FULL_VERSION_STRING);
835 return true;
838 return true;
840 for (const auto &[service, statusFlag] :
vCheckFlag)
841 {
842 std::ostringstream oss;
843 oss << std::left << std::setfill(
'.') << std::setw(
KEY_WIDTH) << service +
" " << std::setw(
VAL_WIDTH)
844 << std::right << (statusFlag->_M_i ? " OK" : " Not Active");
845 session->sendLine(oss.str());
846 }
847 return true;
848
849
850
851
852
853
854
856 session->sendLine("Closing connection");
857 session->sendLine("Goodbye!");
858 session->markTimeout();
859 return true;
860 default:
861 session->sendLine("Unknown command received");
862 return false;
863 }
864}
std::vector< std::pair< std::string, std::shared_ptr< std::atomic_flag > > > vCheckFlag
Global variable to check if the servers are running.
constexpr size_t constHasher(const char *s)
const std::string TELNET_CLEAR_SCREEN("\033[2J")