781{
782 spdlog::trace("Received message {}", line);
783
784
785 session->sendLine(line);
786
787 if (line.empty())
788 {
789 return true;
790 }
791
792
794 {
796 session->sendLine("OK");
797 return true;
800 return true;
802 session->sendLine("Default log mode enabled");
803 spdlog::set_level(spdlog::level::info);
804 return true;
806 session->sendLine("Disabling all logs");
807 spdlog::set_level(spdlog::level::off);
808 return true;
810 session->sendLine("Info log mode enabled");
811 spdlog::set_level(spdlog::level::info);
812 return true;
814 session->sendLine("Debug log mode enabled");
815 spdlog::set_level(spdlog::level::debug);
816 return true;
818 session->sendLine("Trace log mode enabled");
819 spdlog::set_level(spdlog::level::trace);
820 return true;
822 session->sendLine("pong");
823 return true;
825 session->sendLine(PROJECT_FULL_VERSION_STRING);
826 return true;
829 return true;
831 for (const auto &[service, statusFlag] :
vCheckFlag)
832 {
833 std::ostringstream oss;
834 oss << std::left << std::setfill(
'.') << std::setw(
KEY_WIDTH) << service +
" " << std::setw(
VAL_WIDTH)
835 << std::right << (statusFlag->_M_i ? " OK" : " Not Active");
836 session->sendLine(oss.str());
837 }
838 return true;
839
840
841
842
843
844
845
847 session->sendLine("Closing connection");
848 session->sendLine("Goodbye!");
849 session->markTimeout();
850 return true;
851 default:
852 session->sendLine("Unknown command received");
853 return false;
854 }
855}
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")