logger 연결 완료

This commit is contained in:
2024-08-14 10:28:48 +09:00
parent 51f9b25bd8
commit 8607c4a8a5
11 changed files with 120 additions and 92 deletions

View File

@@ -6,14 +6,25 @@
class IBot {
public:
IBot(std::string token, int clusterCount, std::string DBURL, std::string DBID, std::string DBPassword);
IBot(std::string token, std::string DBURL, std::string DBID, std::string DBPassword, int clusterCount = 0);
virtual void start();
virtual void onCommand(const dpp::slashcommand_t &event);
virtual void onReady(const dpp::ready_t &event);
std::vector<std::shared_ptr<dpp::cluster>> botClusters;
std::shared_ptr<dpp::cluster> botCluster;
std::vector<std::shared_ptr<commands::ICommand>> commandsArray;
std::function<void(const dpp::log_t&)> logger() {
return [&](const dpp::log_t& event){
if (event.severity >= dpp::ll_error)
std::cerr << "[" << dpp::utility::current_date_time() << "] " << dpp::utility::loglevel(event.severity) << ": " << event.message << std::endl;
else if (event.severity - logLevel >= 0)
std::clog << "[" << dpp::utility::current_date_time() << "] " << dpp::utility::loglevel(event.severity) << ": " << event.message << std::endl;
};
};
dpp::loglevel logLevel = dpp::ll_debug;
protected:
sql::Driver* DBDriver;
std::shared_ptr<sql::SQLString> DBURL;