From b44bc1cabde48c77d65407d282c67dd087acde38 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 9 Oct 2022 20:16:45 +0300 Subject: [PATCH] Update TDLib and use AsyncFileLog instead of FileLog. --- td | 2 +- telegram-bot-api/Client.cpp | 2 +- telegram-bot-api/ClientManager.cpp | 4 +++- telegram-bot-api/Query.h | 1 + telegram-bot-api/Watchdog.cpp | 1 + telegram-bot-api/telegram-bot-api.cpp | 10 ++++------ 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/td b/td index a7a17b3..c1a3fa6 160000 --- a/td +++ b/td @@ -1 +1 @@ -Subproject commit a7a17b34b3c8fd3f7f6295f152746beb68f34d83 +Subproject commit c1a3fa633fbce67b8b89fee93130498db8adc039 diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 717e391..6329455 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -6593,7 +6593,7 @@ td::Result> Client::get_chat_permiss }(); if (status.is_error()) { - return Status::Error(400, PSLICE() << "Can't parse chat permissions: " << status.error().message()); + return Status::Error(400, PSLICE() << "Can't parse chat permissions: " << status.message()); } } else if (allow_legacy) { allow_legacy = false; diff --git a/telegram-bot-api/ClientManager.cpp b/telegram-bot-api/ClientManager.cpp index 53412b8..c836181 100644 --- a/telegram-bot-api/ClientManager.cpp +++ b/telegram-bot-api/ClientManager.cpp @@ -29,6 +29,7 @@ #include "td/utils/Parser.h" #include "td/utils/port/IPAddress.h" #include "td/utils/port/Stat.h" +#include "td/utils/port/thread.h" #include "td/utils/Slice.h" #include "td/utils/SliceBuilder.h" #include "td/utils/StackAllocator.h" @@ -38,6 +39,7 @@ #include "memprof/memprof.h" #include +#include #include namespace telegram_bot_api { @@ -341,7 +343,7 @@ void ClientManager::start_up() { auto concurrent_webhook_db = td::make_unique>(); auto status = concurrent_webhook_db->init(parameters_->working_directory_ + "webhooks_db.binlog", td::DbKey::empty(), scheduler_id); - LOG_IF(FATAL, status.is_error()) << "Can't open webhooks_db.binlog " << status.error(); + LOG_IF(FATAL, status.is_error()) << "Can't open webhooks_db.binlog " << status; parameters_->shared_data_->webhook_db_ = std::move(concurrent_webhook_db); auto &webhook_db = *parameters_->shared_data_->webhook_db_; diff --git a/telegram-bot-api/Query.h b/telegram-bot-api/Query.h index ca67fa3..7fdad09 100644 --- a/telegram-bot-api/Query.h +++ b/telegram-bot-api/Query.h @@ -23,6 +23,7 @@ #include "td/utils/StringBuilder.h" #include +#include #include #include diff --git a/telegram-bot-api/Watchdog.cpp b/telegram-bot-api/Watchdog.cpp index 362b5f9..8b8105e 100644 --- a/telegram-bot-api/Watchdog.cpp +++ b/telegram-bot-api/Watchdog.cpp @@ -6,6 +6,7 @@ // #include "telegram-bot-api/Watchdog.h" +#include "td/utils/logging.h" #include "td/utils/Time.h" namespace telegram_bot_api { diff --git a/telegram-bot-api/telegram-bot-api.cpp b/telegram-bot-api/telegram-bot-api.cpp index 6d99c07..f41cf25 100644 --- a/telegram-bot-api/telegram-bot-api.cpp +++ b/telegram-bot-api/telegram-bot-api.cpp @@ -20,11 +20,11 @@ #include "td/actor/actor.h" #include "td/actor/ConcurrentScheduler.h" +#include "td/utils/AsyncFileLog.h" #include "td/utils/CombinedLog.h" #include "td/utils/common.h" #include "td/utils/crypto.h" #include "td/utils/ExitGuard.h" -#include "td/utils/FileLog.h" //#include "td/utils/GitInfo.h" #include "td/utils/logging.h" #include "td/utils/MemoryLog.h" @@ -44,7 +44,6 @@ #include "td/utils/SliceBuilder.h" #include "td/utils/Status.h" #include "td/utils/Time.h" -#include "td/utils/TsLog.h" #include #include @@ -315,8 +314,7 @@ int main(int argc, char *argv[]) { log.set_second(&memory_log); td::log_interface = &log; - td::FileLog file_log; - td::TsLog ts_log(&file_log); + td::AsyncFileLog file_log; auto init_status = [&] { #if TD_HAVE_THREAD_AFFINITY @@ -408,13 +406,13 @@ int main(int argc, char *argv[]) { log_file_path = working_directory + log_file_path; } TRY_STATUS_PREFIX(file_log.init(log_file_path, log_max_file_size), "Can't open log file: "); - log.set_first(&ts_log); + log.set_first(&file_log); } return td::Status::OK(); }(); if (init_status.is_error()) { - LOG(PLAIN) << init_status.error().message(); + LOG(PLAIN) << init_status.message(); LOG(PLAIN) << options; return 1; }