From 22fdc0258be44f5e41d927752738473c8d3ff24f Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 26 Feb 2023 14:22:31 +0300 Subject: [PATCH] Use "receive"/"have"/"loaded" instead of "got" and other log message improvements. --- benchmark/bench_queue.cpp | 4 ++-- example/cpp/td_example.cpp | 6 +++--- example/web/tdweb/src/index.js | 6 +++--- example/web/tdweb/src/worker.js | 12 ++++++------ td/mtproto/SessionConnection.cpp | 2 +- td/telegram/ConfigManager.cpp | 5 +++-- td/telegram/DeviceTokenManager.cpp | 2 +- td/telegram/InlineQueriesManager.cpp | 2 +- td/telegram/MessagesManager.cpp | 6 +++--- td/telegram/PrivacyManager.cpp | 4 ++-- td/telegram/SecretChatActor.cpp | 12 ++++++------ td/telegram/SecureManager.cpp | 2 +- td/telegram/TdDb.cpp | 2 +- td/telegram/UpdatesManager.cpp | 2 +- td/telegram/WebPagesManager.cpp | 8 ++++---- td/telegram/files/FileDownloader.cpp | 16 +++++++--------- td/telegram/files/FileLoader.cpp | 4 ++-- td/telegram/net/NetQuery.h | 4 ++-- td/telegram/net/Session.cpp | 7 +++---- td/tl/tl_json.h | 20 ++++++++++---------- tdactor/example/example.cpp | 2 +- tddb/td/db/SqliteStatement.cpp | 2 +- tddb/td/db/SqliteStatement.h | 4 ++-- tdutils/td/utils/MpmcQueue.h | 7 +++---- tdutils/td/utils/MpmcWaiter.h | 6 +++--- tdutils/td/utils/port/detail/Iocp.cpp | 2 +- tdutils/test/misc.cpp | 11 ++++++----- test/mtproto.cpp | 2 +- test/online.cpp | 14 +++++++------- test/secret.cpp | 10 +++++----- test/tdclient.cpp | 18 +++++++++--------- 31 files changed, 101 insertions(+), 103 deletions(-) diff --git a/benchmark/bench_queue.cpp b/benchmark/bench_queue.cpp index 5eb1f898a..c28554c75 100644 --- a/benchmark/bench_queue.cpp +++ b/benchmark/bench_queue.cpp @@ -859,8 +859,8 @@ static void test_queue() { for (size_t i = 0; i < THREAD_COUNT; i++) { threads.emplace_back([&q = queues[i]] { while (true) { - auto got = q.reader_wait_nonblock(); - while (got-- > 0) { + auto ready_count = q.reader_wait_nonblock(); + while (ready_count-- > 0) { q.reader_get_unsafe(); } q.reader_get_event_fd().wait(1000); diff --git a/example/cpp/td_example.cpp b/example/cpp/td_example.cpp index c36d81827..b30afa807 100644 --- a/example/cpp/td_example.cpp +++ b/example/cpp/td_example.cpp @@ -222,8 +222,8 @@ class TdExample { if (update_new_message.message_->content_->get_id() == td_api::messageText::ID) { text = static_cast(*update_new_message.message_->content_).text_->text_; } - std::cout << "Got message: [chat_id:" << chat_id << "] [from:" << sender_name << "] [" << text - << "]" << std::endl; + std::cout << "Receive message: [chat_id:" << chat_id << "] [from:" << sender_name << "] [" + << text << "]" << std::endl; }, [](auto &update) {})); } @@ -242,7 +242,7 @@ class TdExample { overloaded( [this](td_api::authorizationStateReady &) { are_authorized_ = true; - std::cout << "Got authorization" << std::endl; + std::cout << "Authorization is completed" << std::endl; }, [this](td_api::authorizationStateLoggingOut &) { are_authorized_ = false; diff --git a/example/web/tdweb/src/index.js b/example/web/tdweb/src/index.js index 2f159b942..cf365e9b5 100644 --- a/example/web/tdweb/src/index.js +++ b/example/web/tdweb/src/index.js @@ -253,7 +253,7 @@ class TdClient { log.info('ignore self broadcast message: ', message); return; } - log.info('got broadcast message: ', message); + log.info('receive broadcast message: ', message); if (message.isBackground && !this.isBackground) { // continue } else if ( @@ -506,7 +506,7 @@ class FileManager { } if (info.arr) { - log.warn('Got file.arr at least twice for the same file'); + log.warn('Receive file.arr at least twice for the same file'); this.totalSize -= info.arr.length; } info.arr = file.arr; @@ -543,7 +543,7 @@ class FileManager { const blob = event.target.result; if (blob) { if (blob.size === 0) { - log.error('Got empty blob from db ', query.key); + log.error('Receive empty blob from db ', query.key); } query.resolve({ data: blob, transaction_id: transaction_id }); } else { diff --git a/example/web/tdweb/src/worker.js b/example/web/tdweb/src/worker.js index dff184512..3323a0502 100644 --- a/example/web/tdweb/src/worker.js +++ b/example/web/tdweb/src/worker.js @@ -65,7 +65,7 @@ async function loadTdlibWasm(onFS, wasmUrl) { console.log('loadTdlibWasm'); const td_module = await import('./prebuilt/release/td_wasm.js'); const createTdwebModule = td_module.default; - log.info('got td_wasm.js', td_module, createTdwebModule); + log.info('receive td_wasm.js', td_module, createTdwebModule); let td_wasm = td_wasm_release; if (wasmUrl) { td_wasm = wasmUrl; @@ -88,7 +88,7 @@ async function loadTdlibWasm(onFS, wasmUrl) { }); log.info('Wait module'); module = await module; - log.info('Got module', module); + log.info('Loaded module', module); //onFS(module.FS); return module; } @@ -97,7 +97,7 @@ async function loadTdlibAsmjs(onFS) { console.log('loadTdlibAsmjs'); const createTdwebModule = (await import('./prebuilt/release/td_asmjs.js')) .default; - console.log('got td_asm.js', createTdwebModule); + console.log('Loaded td_asm.js', createTdwebModule); const fromFile = 'td_asmjs.js.mem'; const toFile = td_asmjs_mem_release; let module = createTdwebModule({ @@ -115,7 +115,7 @@ async function loadTdlibAsmjs(onFS) { }); log.info('Wait module'); module = await module; - log.info('Got module', module); + log.info('Loaded module', module); //onFS(module.FS); return module; } @@ -575,7 +575,7 @@ class TdClient { await localforage.setItem('hello', 'world'); console.log('B'); const x = await localforage.getItem('hello'); - console.log('got ', x); + console.log('receive ', x); await localforage.clear(); console.log('C'); } catch (error) { @@ -612,7 +612,7 @@ class TdClient { log.info('load TdModule'); this.TdModule = await loadTdlib(mode, this.onFS, options.wasmUrl); - log.info('got TdModule'); + log.info('loaded TdModule'); this.td_functions = { td_create: this.TdModule.cwrap( 'td_emscripten_create_client_id', diff --git a/td/mtproto/SessionConnection.cpp b/td/mtproto/SessionConnection.cpp index 5228c93c3..a806a20b0 100644 --- a/td/mtproto/SessionConnection.cpp +++ b/td/mtproto/SessionConnection.cpp @@ -539,7 +539,7 @@ Status SessionConnection::on_main_packet(const PacketInfo &info, Slice packet) { callback_->on_connected(); } - VLOG(raw_mtproto) << "Got packet of size " << packet.size() << " from session " << format::as_hex(info.session_id) + VLOG(raw_mtproto) << "Receive packet of size " << packet.size() << " from session " << format::as_hex(info.session_id) << ":" << format::as_hex_dump<4>(packet); if (info.no_crypto_flag) { return Status::Error("Unencrypted packet"); diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 113e31d89..2640141a0 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -674,7 +674,7 @@ class ConfigRecoverer final : public Actor { } } } - VLOG(config_recoverer) << "Got SimpleConfig " << simple_config_; + VLOG(config_recoverer) << "Receive SimpleConfig " << simple_config_; } else { VLOG(config_recoverer) << "Config has expired at " << config->expires_; } @@ -927,7 +927,8 @@ ActorShared<> ConfigManager::create_reference() { } void ConfigManager::hangup_shared() { - LOG_CHECK(get_link_token() == REFCNT_TOKEN) << "Expected REFCNT_TOKEN, got " << get_link_token(); + LOG_CHECK(get_link_token() == REFCNT_TOKEN) + << "Expected link token " << REFCNT_TOKEN << ", but receive " << get_link_token(); ref_cnt_--; try_stop(); } diff --git a/td/telegram/DeviceTokenManager.cpp b/td/telegram/DeviceTokenManager.cpp index d192d84e4..5b712dc76 100644 --- a/td/telegram/DeviceTokenManager.cpp +++ b/td/telegram/DeviceTokenManager.cpp @@ -451,7 +451,7 @@ void DeviceTokenManager::on_result(NetQueryPtr net_query) { } info.promise.set_error(r_flag.move_as_error()); } else { - info.promise.set_error(Status::Error(400, "Got false as result of registerDevice server request")); + info.promise.set_error(Status::Error(400, "Receive false as result of registerDevice server request")); } if (info.state == TokenInfo::State::Reregister) { // keep trying to reregister the token diff --git a/td/telegram/InlineQueriesManager.cpp b/td/telegram/InlineQueriesManager.cpp index 0d0352499..6377887c3 100644 --- a/td/telegram/InlineQueriesManager.cpp +++ b/td/telegram/InlineQueriesManager.cpp @@ -337,7 +337,7 @@ string InlineQueriesManager::get_inline_message_id( if (input_bot_inline_message_id == nullptr) { return string(); } - LOG(INFO) << "Got inline message identifier: " << to_string(input_bot_inline_message_id); + LOG(INFO) << "Receive inline message identifier: " << to_string(input_bot_inline_message_id); return base64url_encode(serialize(*input_bot_inline_message_id)); } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index e3b0eaa14..c230e106d 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -14183,8 +14183,8 @@ void MessagesManager::ttl_db_on_result(Result PrivacyManager::UserPrivacySettin auto td = G()->td().get_actor_unsafe(); for (auto user_id : result.user_ids_) { if (!td->contacts_manager_->have_user(user_id)) { - return Status::Error(500, "Got inaccessible user from the server"); + return Status::Error(500, "Receive inaccessible user from the server"); } } for (auto chat_id_int : result.chat_ids_) { @@ -317,7 +317,7 @@ Result PrivacyManager::UserPrivacySettin ChannelId channel_id(chat_id_int); dialog_id = DialogId(channel_id); if (!td->contacts_manager_->have_channel(channel_id)) { - return Status::Error(500, "Got inaccessible chat from the server"); + return Status::Error(500, "Receive inaccessible chat from the server"); } } td->messages_manager_->force_create_dialog(dialog_id, "UserPrivacySettingRule"); diff --git a/td/telegram/SecretChatActor.cpp b/td/telegram/SecretChatActor.cpp index 9db8b30ab..76ab0aa24 100644 --- a/td/telegram/SecretChatActor.cpp +++ b/td/telegram/SecretChatActor.cpp @@ -809,11 +809,11 @@ Result> SecretChatActor::decrypt(BufferSl TRY_RESULT(read_result, std::move(r_read_result)); switch (read_result.type()) { case mtproto::Transport::ReadResult::Quickack: - return Status::Error("Got quickack instead of a message"); + return Status::Error("Receive quickack instead of a message"); case mtproto::Transport::ReadResult::Error: - return Status::Error(PSLICE() << "Got MTProto error code instead of a message: " << read_result.error()); + return Status::Error(PSLICE() << "Receive MTProto error code instead of a message: " << read_result.error()); case mtproto::Transport::ReadResult::Nop: - return Status::Error("Got nop instead of a message"); + return Status::Error("Receive nop instead of a message"); case mtproto::Transport::ReadResult::Packet: data = read_result.packet(); break; @@ -1582,7 +1582,7 @@ void SecretChatActor::on_outbound_send_message_result(NetQueryPtr query, Promise } auto result = r_result.move_as_ok(); - LOG(INFO) << "Got messages_sendEncrypted result: " << tag("message_id", state->message->message_id) + LOG(INFO) << "Receive messages_sendEncrypted result: " << tag("message_id", state->message->message_id) << tag("random_id", state->message->random_id) << to_string(*result); auto send_message_finish_promise = PromiseCreator::lambda([actor_id = actor_id(this), state_id](Result<> result) { @@ -1913,7 +1913,7 @@ void SecretChatActor::get_dh_config() { } Status SecretChatActor::on_dh_config(NetQueryPtr query) { - LOG(INFO) << "Got DH config"; + LOG(INFO) << "Receive DH config"; TRY_RESULT(config, fetch_result(std::move(query))); downcast_call(*config, [&](auto &obj) { this->on_dh_config(obj); }); TRY_STATUS(mtproto::DhHandshake::check_config(auth_state_.dh_config.g, auth_state_.dh_config.prime, @@ -2104,7 +2104,7 @@ Status SecretChatActor::on_inbound_action(secret_api::decryptedMessageActionRequ return Status::Error("Unexpected RequestKey"); } if (!pfs_state_.other_auth_key.empty()) { - LOG_CHECK(pfs_state_.can_forget_other_key) << "TODO: got requestKey, before old key is dropped"; + LOG_CHECK(pfs_state_.can_forget_other_key) << "TODO: receive requestKey, before old key is dropped"; return Status::Error("Unexpected RequestKey (old key is used)"); } pfs_state_.state = PfsState::SendAccept; diff --git a/td/telegram/SecureManager.cpp b/td/telegram/SecureManager.cpp index 99538bbc3..594a41f08 100644 --- a/td/telegram/SecureManager.cpp +++ b/td/telegram/SecureManager.cpp @@ -231,7 +231,7 @@ void GetSecureValue::on_result(NetQueryPtr query) { return on_error(Status::Error(404, "Not Found")); } if (result.size() != 1) { - return on_error(Status::Error(PSLICE() << "Expected vector of size 1 got " << result.size())); + return on_error(Status::Error(PSLICE() << "Expected result of size 1, but receive of size " << result.size())); } encrypted_secure_value_ = get_encrypted_secure_value(G()->td().get_actor_unsafe()->file_manager_.get(), std::move(result[0])); diff --git a/td/telegram/TdDb.cpp b/td/telegram/TdDb.cpp index d9ba160cb..93b798f87 100644 --- a/td/telegram/TdDb.cpp +++ b/td/telegram/TdDb.cpp @@ -352,7 +352,7 @@ Status TdDb::init_sqlite(const TdParameters ¶meters, const DbKey &key, const // Get 'PRAGMA user_version' TRY_RESULT(user_version, db.user_version()); - LOG(INFO) << "Got PRAGMA user_version = " << user_version; + LOG(INFO) << "Have PRAGMA user_version = " << user_version; // init DialogDb bool dialog_db_was_created = false; diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index bed2121e1..9c801059c 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -2505,7 +2505,7 @@ void UpdatesManager::add_pending_pts_update(tl_object_ptr } if (running_get_difference_ || !postponed_pts_updates_.empty()) { - LOG(INFO) << "Save pending update got while running getDifference from " << source; + LOG(INFO) << "Save pending update received while running getDifference from " << source; postpone_pts_update(std::move(update), new_pts, pts_count, receive_time, std::move(promise)); return; } diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index 0bbc2c822..50c046136 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -424,7 +424,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr if (td_->auth_manager_->is_bot()) { return WebPageId(); } - LOG(DEBUG) << "Got " << to_string(web_page_ptr); + LOG(DEBUG) << "Receive " << to_string(web_page_ptr); switch (web_page_ptr->get_id()) { case telegram_api::webPageEmpty::ID: { auto web_page = move_tl_object_as(web_page_ptr); @@ -434,7 +434,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr return WebPageId(); } - LOG(INFO) << "Got empty " << web_page_id; + LOG(INFO) << "Receive empty " << web_page_id; const WebPage *web_page_to_delete = get_web_page(web_page_id); if (web_page_to_delete != nullptr) { if (web_page_to_delete->log_event_id != 0) { @@ -467,7 +467,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr } auto web_page_date = web_page->date_; - LOG(INFO) << "Got pending " << web_page_id << ", force_get_date = " << web_page_date + LOG(INFO) << "Receive pending " << web_page_id << ", force_get_date = " << web_page_date << ", now = " << G()->server_time(); pending_web_pages_timeout_.add_timeout_in(web_page_id.get(), max(web_page_date - G()->server_time(), 1.0)); @@ -481,7 +481,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr return WebPageId(); } - LOG(INFO) << "Got " << web_page_id; + LOG(INFO) << "Receive " << web_page_id; auto page = make_unique(); page->url = std::move(web_page->url_); diff --git a/td/telegram/files/FileDownloader.cpp b/td/telegram/files/FileDownloader.cpp index 7f2f1c95e..5fe3a5b66 100644 --- a/td/telegram/files/FileDownloader.cpp +++ b/td/telegram/files/FileDownloader.cpp @@ -166,7 +166,7 @@ Result FileDownloader::should_restart_part(Part part, NetQueryPtr &net_que TRY_RESULT(file_base, fetch_result(net_query->ok())); CHECK(file_base->get_id() == telegram_api::upload_fileCdnRedirect::ID); auto file = move_tl_object_as(file_base); - LOG(DEBUG) << part.id << " got REDIRECT " << to_string(file); + LOG(DEBUG) << "Downloading of part " << part.id << " was redirected to " << oneline(to_string(file)); auto new_cdn_file_token = file->file_token_.as_slice(); if (cdn_file_token_ == new_cdn_file_token) { @@ -192,7 +192,7 @@ Result FileDownloader::should_restart_part(Part part, NetQueryPtr &net_que case QueryType::ReuploadCDN: { TRY_RESULT(file_hashes, fetch_result(net_query->ok())); add_hash_info(file_hashes); - LOG(DEBUG) << part.id << " got REUPLOAD_OK"; + LOG(DEBUG) << "Part " << part.id << " was reuplaoded to CDN"; return true; } case QueryType::CDN: { @@ -200,14 +200,14 @@ Result FileDownloader::should_restart_part(Part part, NetQueryPtr &net_que TRY_RESULT(file_base, fetch_result(net_query->ok())); CHECK(file_base->get_id() == telegram_api::upload_cdnFileReuploadNeeded::ID); auto file = move_tl_object_as(file_base); - LOG(DEBUG) << part.id << " got REUPLOAD " << to_string(file); + LOG(DEBUG) << "Part " << part.id << " must be reuplaoded to " << oneline(to_string(file)); cdn_part_reupload_token_[part.id] = file->request_token_.as_slice().str(); return true; } auto it = cdn_part_file_token_generation_.find(part.id); CHECK(it != cdn_part_file_token_generation_.end()); if (it->second != cdn_file_token_generation_) { - LOG(DEBUG) << part.id << " got part with old file_token"; + LOG(DEBUG) << "Receive part " << part.id << " with an old file_token"; return true; } return false; @@ -266,13 +266,11 @@ Result> FileDownloader::start_part(Part part, int32 if (it == cdn_part_reupload_token_.end()) { auto query = telegram_api::upload_getCdnFile(BufferSlice(cdn_file_token_), part.offset, narrow_cast(size)); cdn_part_file_token_generation_[part.id] = cdn_file_token_generation_; - LOG(DEBUG) << part.id << " " << to_string(query); net_query = G()->net_query_creator().create(UniqueId::next(UniqueId::Type::Default, static_cast(QueryType::CDN)), query, {}, cdn_dc_id_, net_query_type, NetQuery::AuthFlag::Off); } else { auto query = telegram_api::upload_reuploadCdnFile(BufferSlice(cdn_file_token_), BufferSlice(it->second)); - LOG(DEBUG) << part.id << " " << to_string(query); net_query = G()->net_query_creator().create( UniqueId::next(UniqueId::Type::Default, static_cast(QueryType::ReuploadCDN)), query, {}, remote_.get_dc_id(), net_query_type, NetQuery::AuthFlag::On); @@ -311,7 +309,7 @@ Result FileDownloader::process_part(Part part, NetQueryPtr net_query) { TRY_RESULT(file_base, fetch_result(net_query->ok())); CHECK(file_base->get_id() == telegram_api::upload_file::ID); auto file = move_tl_object_as(file_base); - LOG(DEBUG) << part.id << " upload.getFile result " << to_string(file); + LOG(DEBUG) << "Receive part " << part.id << ": " << to_string(file); bytes = std::move(file->bytes_); } break; @@ -320,7 +318,7 @@ Result FileDownloader::process_part(Part part, NetQueryPtr net_query) { TRY_RESULT(file_base, fetch_result(net_query->ok())); CHECK(file_base->get_id() == telegram_api::upload_cdnFile::ID); auto file = move_tl_object_as(file_base); - LOG(DEBUG) << part.id << " upload.getCdnFile result " << to_string(file); + LOG(DEBUG) << "Receive part " << part.id << " from CDN: " << to_string(file); bytes = std::move(file->bytes_); need_cdn_decrypt = true; break; @@ -366,7 +364,7 @@ Result FileDownloader::process_part(Part part, NetQueryPtr net_query) { auto slice = bytes.as_slice().substr(0, part.size); TRY_STATUS(acquire_fd()); - LOG(INFO) << "Got " << slice.size() << " bytes at offset " << part.offset << " for \"" << path_ << '"'; + LOG(INFO) << "Receive " << slice.size() << " bytes at offset " << part.offset << " for \"" << path_ << '"'; TRY_RESULT(written, fd_.pwrite(slice, part.offset)); LOG(INFO) << "Written " << written << " bytes"; // may write less than part.size, when size of downloadable file is unknown diff --git a/td/telegram/files/FileLoader.cpp b/td/telegram/files/FileLoader.cpp index 143a205fb..63c735ba1 100644 --- a/td/telegram/files/FileLoader.cpp +++ b/td/telegram/files/FileLoader.cpp @@ -196,7 +196,7 @@ Status FileLoader::do_loop() { break; } if (resource_state_.unused() < narrow_cast(parts_manager_.get_part_size())) { - VLOG(file_loader) << "Got only " << resource_state_.unused() << " resource"; + VLOG(file_loader) << "Receive only " << resource_state_.unused() << " resource"; break; } TRY_RESULT(part, parts_manager_.start_part()); @@ -268,7 +268,7 @@ void FileLoader::on_result(NetQueryPtr query) { } auto it = part_map_.find(unique_id); if (it == part_map_.end()) { - LOG(WARNING) << "Got result for unknown part"; + LOG(WARNING) << "Receive result for unknown part"; return; } diff --git a/td/telegram/net/NetQuery.h b/td/telegram/net/NetQuery.h index 592b44373..b2ebcb3b1 100644 --- a/td/telegram/net/NetQuery.h +++ b/td/telegram/net/NetQuery.h @@ -130,7 +130,7 @@ class NetQuery final : public TsListNode { } void set_ok(BufferSlice slice) { - VLOG(net_query) << "Got answer " << *this; + VLOG(net_query) << "Receive answer " << *this; CHECK(state_ == State::Query); answer_ = std::move(slice); state_ = State::OK; @@ -323,7 +323,7 @@ class NetQuery final : public TsListNode { ActorShared callback_; void set_error_impl(Status status, string source = string()) { - VLOG(net_query) << "Got error " << *this << " " << status; + VLOG(net_query) << "Receive error " << *this << " " << status; status_ = std::move(status); state_ = State::Error; source_ = std::move(source); diff --git a/td/telegram/net/Session.cpp b/td/telegram/net/Session.cpp index be401ec4d..5aee90f10 100644 --- a/td/telegram/net/Session.cpp +++ b/td/telegram/net/Session.cpp @@ -373,7 +373,7 @@ void Session::send(NetQueryPtr &&query) { // query->debug(PSTRING() << get_name() << ": received from SessionProxy"); query->set_session_id(auth_data_.get_session_id()); - VLOG(net_query) << "Got query " << query; + VLOG(net_query) << "Receive query " << query; if (query->update_is_ready()) { return_query(std::move(query)); return; @@ -417,7 +417,7 @@ void Session::on_bind_result(NetQueryPtr query) { } else { need_check_main_key_ = true; auth_data_.set_use_pfs(false); - LOG(WARNING) << "Got ENCRYPTED_MESSAGE_INVALID error, validate main key" << debug; + LOG(WARNING) << "Receive ENCRYPTED_MESSAGE_INVALID error, validate main key" << debug; } } } @@ -1254,7 +1254,7 @@ void Session::connection_open_finish(ConnectionInfo *info, auto raw_connection = r_raw_connection.move_as_ok(); VLOG(dc) << "Receive raw connection " << raw_connection.get(); if (raw_connection->extra().extra != network_generation_) { - LOG(WARNING) << "Got RawConnection with old network_generation"; + LOG(WARNING) << "Receive RawConnection with old network_generation"; info->state_ = ConnectionInfo::State::Empty; yield(); return; @@ -1434,7 +1434,6 @@ void Session::on_handshake_ready(Result> r if (auth_data_.update_server_time_difference(handshake->get_server_time_diff())) { on_server_time_difference_updated(); } - LOG(INFO) << "Got " << (is_main ? "main" : "tmp") << " auth key"; } } diff --git a/td/tl/tl_json.h b/td/tl/tl_json.h index 1a53b0759..5d3e376d0 100644 --- a/td/tl/tl_json.h +++ b/td/tl/tl_json.h @@ -63,7 +63,7 @@ inline Status from_json(int32 &to, JsonValue from) { if (from.type() == JsonValue::Type::Null) { return Status::OK(); } - return Status::Error(PSLICE() << "Expected Number, got " << from.type()); + return Status::Error(PSLICE() << "Expected Number, but receive " << from.type()); } Slice number = from.type() == JsonValue::Type::String ? from.get_string() : from.get_number(); TRY_RESULT_ASSIGN(to, to_integer_safe(number)); @@ -82,7 +82,7 @@ inline Status from_json(bool &to, JsonValue from) { to = x != 0; return Status::OK(); } - return Status::Error(PSLICE() << "Expected Boolean, got " << from_type); + return Status::Error(PSLICE() << "Expected Boolean, but receive " << from_type); } to = from.get_boolean(); return Status::OK(); @@ -93,7 +93,7 @@ inline Status from_json(int64 &to, JsonValue from) { if (from.type() == JsonValue::Type::Null) { return Status::OK(); } - return Status::Error(PSLICE() << "Expected String or Number, got " << from.type()); + return Status::Error(PSLICE() << "Expected String or Number, but receive " << from.type()); } Slice number = from.type() == JsonValue::Type::String ? from.get_string() : from.get_number(); TRY_RESULT_ASSIGN(to, to_integer_safe(number)); @@ -105,7 +105,7 @@ inline Status from_json(double &to, JsonValue from) { if (from.type() == JsonValue::Type::Null) { return Status::OK(); } - return Status::Error(PSLICE() << "Expected Number, got " << from.type()); + return Status::Error(PSLICE() << "Expected Number, but receive " << from.type()); } to = to_double(from.get_number()); return Status::OK(); @@ -116,7 +116,7 @@ inline Status from_json(string &to, JsonValue from) { if (from.type() == JsonValue::Type::Null) { return Status::OK(); } - return Status::Error(PSLICE() << "Expected String, got " << from.type()); + return Status::Error(PSLICE() << "Expected String, but receive " << from.type()); } to = from.get_string().str(); return Status::OK(); @@ -127,7 +127,7 @@ inline Status from_json_bytes(string &to, JsonValue from) { if (from.type() == JsonValue::Type::Null) { return Status::OK(); } - return Status::Error(PSLICE() << "Expected String, got " << from.type()); + return Status::Error(PSLICE() << "Expected String, but receive " << from.type()); } TRY_RESULT_ASSIGN(to, base64_decode(from.get_string())); return Status::OK(); @@ -139,7 +139,7 @@ Status from_json(std::vector &to, JsonValue from) { if (from.type() == JsonValue::Type::Null) { return Status::OK(); } - return Status::Error(PSLICE() << "Expected Array, got " << from.type()); + return Status::Error(PSLICE() << "Expected Array, but receive " << from.type()); } to = std::vector(from.get_array().size()); size_t i = 0; @@ -157,7 +157,7 @@ std::enable_if_t::value, Status> from_json(tl_object_p to = nullptr; return Status::OK(); } - return Status::Error(PSLICE() << "Expected Object, got " << from.type()); + return Status::Error(PSLICE() << "Expected Object, but receive " << from.type()); } auto &object = from.get_object(); @@ -168,7 +168,7 @@ std::enable_if_t::value, Status> from_json(tl_object_p } else if (constructor_value.type() == JsonValue::Type::String) { TRY_RESULT_ASSIGN(constructor, tl_constructor_from_string(to.get(), constructor_value.get_string().str())); } else { - return Status::Error(PSLICE() << "Expected String or Integer, got " << constructor_value.type()); + return Status::Error(PSLICE() << "Expected String or Integer, but receive " << constructor_value.type()); } TlDowncastHelper helper(constructor); @@ -193,7 +193,7 @@ std::enable_if_t::value, Status> from_json(tl_object_pt to = nullptr; return Status::OK(); } - return Status::Error(PSLICE() << "Expected Object, got " << from.type()); + return Status::Error(PSLICE() << "Expected Object, but receive " << from.type()); } to = make_tl_object(); return from_json(*to, from.get_object()); diff --git a/tdactor/example/example.cpp b/tdactor/example/example.cpp index bdb184835..080df2baa 100644 --- a/tdactor/example/example.cpp +++ b/tdactor/example/example.cpp @@ -13,7 +13,7 @@ class Worker final : public td::Actor { public: void ping(int x) { - LOG(ERROR) << "Got ping " << x; + LOG(ERROR) << "Receive ping " << x; } }; diff --git a/tddb/td/db/SqliteStatement.cpp b/tddb/td/db/SqliteStatement.cpp index 9bd6e5e46..d9214d34e 100644 --- a/tddb/td/db/SqliteStatement.cpp +++ b/tddb/td/db/SqliteStatement.cpp @@ -183,7 +183,7 @@ Status SqliteStatement::step() { auto rc = tdsqlite3_step(stmt_.get()); VLOG(sqlite) << "Finish step with response " << (rc == SQLITE_ROW ? "ROW" : (rc == SQLITE_DONE ? "DONE" : "ERROR")); if (rc == SQLITE_ROW) { - state_ = State::GotRow; + state_ = State::HaveRow; return Status::OK(); } diff --git a/tddb/td/db/SqliteStatement.h b/tddb/td/db/SqliteStatement.h index e62b11b12..1bcf82eff 100644 --- a/tddb/td/db/SqliteStatement.h +++ b/tddb/td/db/SqliteStatement.h @@ -51,7 +51,7 @@ class SqliteStatement { return state_ != State::Finish; } bool has_row() const { - return state_ == State::GotRow; + return state_ == State::HaveRow; } bool empty() const { return !stmt_; @@ -76,7 +76,7 @@ class SqliteStatement { void operator()(tdsqlite3_stmt *stmt); }; - enum class State { Start, GotRow, Finish }; + enum class State { Start, HaveRow, Finish }; State state_ = State::Start; std::unique_ptr stmt_; diff --git a/tdutils/td/utils/MpmcQueue.h b/tdutils/td/utils/MpmcQueue.h index 799016b9b..371866cae 100644 --- a/tdutils/td/utils/MpmcQueue.h +++ b/tdutils/td/utils/MpmcQueue.h @@ -316,7 +316,7 @@ class MpmcQueueOld { std::atomic next_{nullptr}; char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic)]; MpmcQueueBlock block; - //Got pad in MpmcQueueBlock + // MpmcQueueBlock is already padded }; std::atomic write_pos_{nullptr}; char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic)]; @@ -324,7 +324,7 @@ class MpmcQueueOld { char pad2[TD_CONCURRENCY_PAD - sizeof(std::atomic)]; size_t block_size_; HazardPointers hazard_pointers_; - //Got pad in HazardPointers + // HazardPointers is already padded }; template @@ -448,14 +448,13 @@ class MpmcQueue { Block block; std::atomic next{nullptr}; char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic)]; - //Got pad in MpmcQueueBlock }; std::atomic write_pos_{nullptr}; char pad[TD_CONCURRENCY_PAD - sizeof(std::atomic)]; std::atomic read_pos_{nullptr}; char pad2[TD_CONCURRENCY_PAD - sizeof(std::atomic)]; HazardPointers hazard_pointers_; - //Got pad in HazardPointers + // HazardPointers is already padded }; } // namespace td diff --git a/tdutils/td/utils/MpmcWaiter.h b/tdutils/td/utils/MpmcWaiter.h index 38c3bff6d..6d54aaed5 100644 --- a/tdutils/td/utils/MpmcWaiter.h +++ b/tdutils/td/utils/MpmcWaiter.h @@ -281,16 +281,16 @@ class MpmcSleepyWaiter { auto view = StateView(state_.load()); //LOG(ERROR) << view.parked_count; if (view.searching_count > 0 || view.parked_count == 0) { - VLOG(waiter) << "Ingore notify: " << view.searching_count << " " << view.parked_count; + VLOG(waiter) << "Ingore notify: " << view.searching_count << ' ' << view.parked_count; return; } - VLOG(waiter) << "Notify: " << view.searching_count << " " << view.parked_count; + VLOG(waiter) << "Notify: " << view.searching_count << ' ' << view.parked_count; std::unique_lock guard(sleepers_mutex_); view = StateView(state_.load()); if (view.searching_count > 0) { - VLOG(waiter) << "Skip notify: got searching"; + VLOG(waiter) << "Skip notify: search is active"; return; } diff --git a/tdutils/td/utils/port/detail/Iocp.cpp b/tdutils/td/utils/port/detail/Iocp.cpp index d348ecc1c..546765d1b 100644 --- a/tdutils/td/utils/port/detail/Iocp.cpp +++ b/tdutils/td/utils/port/detail/Iocp.cpp @@ -27,7 +27,7 @@ void Iocp::loop() { BOOL ok = GetQueuedCompletionStatus(iocp_handle_->fd(), &bytes, &key, reinterpret_cast(&overlapped), 1000); if (bytes || key || overlapped) { - // LOG(ERROR) << "Got IOCP " << bytes << " " << key << " " << overlapped; + // LOG(ERROR) << "Receive IOCP completion status: " << bytes << ' ' << key << ' ' << overlapped; } if (ok) { auto callback = reinterpret_cast(key); diff --git a/tdutils/test/misc.cpp b/tdutils/test/misc.cpp index 05f9b16d9..e1612a992 100644 --- a/tdutils/test/misc.cpp +++ b/tdutils/test/misc.cpp @@ -441,7 +441,7 @@ static void test_to_double_one(td::CSlice str, td::Slice expected, int precision auto result = PSTRING() << td::StringBuilder::FixedDouble(to_double(str), precision); if (expected != result) { LOG(ERROR) << "To double conversion failed: have " << str << ", expected " << expected << ", parsed " - << to_double(str) << ", got " << result; + << to_double(str) << ", receive " << result; } } @@ -517,7 +517,8 @@ TEST(Misc, print_uint) { static void test_idn_to_ascii_one(const td::string &host, const td::string &result) { if (result != td::idn_to_ascii(host).ok()) { - LOG(ERROR) << "Failed to convert " << host << " to " << result << ", got \"" << td::idn_to_ascii(host).ok() << "\""; + LOG(ERROR) << "Failed to convert " << host << " to " << result << ", receive \"" << td::idn_to_ascii(host).ok() + << "\""; } } @@ -835,9 +836,9 @@ TEST(Misc, StringBuilder) { if (use_buf) { ASSERT_EQ(res, sb.as_cslice()); } else { - auto got = sb.as_cslice(); - res.resize(got.size()); - ASSERT_EQ(res, got); + auto sb_result = sb.as_cslice(); + res.resize(sb_result.size()); + ASSERT_EQ(res, sb_result); } } } diff --git a/test/mtproto.cpp b/test/mtproto.cpp index a94d15556..07975031b 100644 --- a/test/mtproto.cpp +++ b/test/mtproto.cpp @@ -241,7 +241,7 @@ class TestPingActor final : public td::Actor { return stop(); } if (ping_connection_->was_pong()) { - LOG(INFO) << "GOT PONG"; + LOG(INFO) << "Receive pong"; return stop(); } } diff --git a/test/online.cpp b/test/online.cpp index fd758129d..de7afa8a6 100644 --- a/test/online.cpp +++ b/test/online.cpp @@ -321,7 +321,7 @@ class UploadFile : public Task { auto r_id = read_file(id_path_); if (r_id.is_ok() && r_id.ok().size() > 10) { auto id = r_id.move_as_ok(); - LOG(ERROR) << "Got file from cache"; + LOG(ERROR) << "Receive file from cache"; Result res; res.content = std::move(content_); res.remote_id = id.as_slice().str(); @@ -437,12 +437,12 @@ class TestDownloadFile : public Task { start_chunk(); } - void got_chunk(const td_api::file &file) { - LOG(ERROR) << "Got chunk"; + void on_get_chunk(const td_api::file &file) { + LOG(ERROR) << "Receive chunk"; auto range = ranges_.back(); - std::string got_chunk(range.end - range.begin, '\0'); - FileFd::open(file.local_->path_, FileFd::Flags::Read).move_as_ok().pread(got_chunk, range.begin).ensure(); - CHECK(got_chunk == as_slice(content_).substr(range.begin, range.end - range.begin)); + std::string received_chunk(range.end - range.begin, '\0'); + FileFd::open(file.local_->path_, FileFd::Flags::Read).move_as_ok().pread(received_chunk, range.begin).ensure(); + CHECK(received_chunk == as_slice(content_).substr(range.begin, range.end - range.begin)); ranges_.pop_back(); if (ranges_.empty()) { promise_.set_value(Unit{}); @@ -455,7 +455,7 @@ class TestDownloadFile : public Task { send_query(td::make_tl_object( file_id_, 1, static_cast(ranges_.back().begin), static_cast(ranges_.back().end - ranges_.back().begin), true), - [this](auto res) { got_chunk(*res.ok()); }); + [this](auto res) { on_get_chunk(*res.ok()); }); } }; diff --git a/test/secret.cpp b/test/secret.cpp index 253657f37..bd5470569 100644 --- a/test/secret.cpp +++ b/test/secret.cpp @@ -764,11 +764,11 @@ class Master final : public Actor { bob_ = create_actor("SecretChatProxy bob", "bob", actor_shared(this, 2)); send_closure(alice_.get_actor_unsafe()->actor_, &SecretChatActor::create_chat, UserId(static_cast(2)), 0, 123, PromiseCreator::lambda([actor_id = actor_id(this)](Result res) { - send_closure(actor_id, &Master::got_secret_chat_id, std::move(res), false); + send_closure(actor_id, &Master::on_get_secret_chat_id, std::move(res), false); })); } - void got_secret_chat_id(Result res, bool dummy) { + void on_get_secret_chat_id(Result res, bool dummy) { CHECK(res.is_ok()); auto id = res.move_as_ok(); LOG(INFO) << "SecretChatId = " << id; @@ -825,7 +825,7 @@ class Master final : public Actor { } void process_net_query(my_api::messages_getDhConfig &&get_dh_config, NetQueryPtr net_query, ActorShared callback) { - //LOG(INFO) << "Got query " << to_string(get_dh_config); + //LOG(INFO) << "Receive query " << to_string(get_dh_config); my_api::messages_dhConfig config; config.p_ = BufferSlice(base64url_decode(prime_base64).move_as_ok()); config.g_ = g; @@ -914,7 +914,7 @@ class Master final : public Actor { int32 last_ping_ = std::numeric_limits::max(); void on_inbound_message(string message, Promise<> promise) { promise.set_value(Unit()); - LOG(INFO) << "GOT INBOUND MESSAGE: " << message << " " << get_link_token(); + LOG(INFO) << "Receive inbound message: " << message << " " << get_link_token(); int32 cnt; int x = std::sscanf(message.c_str(), "PING: %d", &cnt); if (x != 1) { @@ -967,7 +967,7 @@ class Master final : public Actor { std::map sent_messages_; void hangup_shared() final { - LOG(INFO) << "GOT HANGUP: " << get_link_token(); + LOG(INFO) << "Receive hang up: " << get_link_token(); send_closure(from(), &SecretChatProxy::on_closed); } }; diff --git a/test/tdclient.cpp b/test/tdclient.cpp index 3514089b7..a608c7559 100644 --- a/test/tdclient.cpp +++ b/test/tdclient.cpp @@ -146,7 +146,7 @@ class TestClient final : public td::Actor { td::rmrf(name_).ignore(); auto old_context = set_context(std::make_shared()); set_tag(name_); - LOG(INFO) << "START UP!"; + LOG(INFO) << "Start up!"; td_client_ = td::create_actor("Td-proxy", make_td_callback()); } @@ -251,7 +251,7 @@ class DoAuthentication final : public TestClinetTask { send_query(std::move(function), [](auto res) { LOG_CHECK(res->get_id() == td::td_api::ok::ID) << to_string(res); }); } void on_authorization_ready() { - LOG(INFO) << "GOT AUTHORIZED"; + LOG(INFO) << "Authorization is completed"; stop(); } @@ -294,7 +294,7 @@ class SetUsername final : public TestClinetTask { self_id_ = user->id_; auto current_username = user->usernames_ != nullptr ? user->usernames_->editable_username_ : td::string(); if (current_username != username_) { - LOG(INFO) << "SET USERNAME: " << username_; + LOG(INFO) << "Set username: " << username_; send_query(td::make_tl_object(username_), [this](auto res) { CHECK(res->get_id() == td::td_api::ok::ID); this->send_self_message(); @@ -330,7 +330,7 @@ class SetUsername final : public TestClinetTask { auto messageText = td::move_tl_object_as(message->content_); auto text = messageText->text_->text_; if (text.substr(0, tag_.size()) == tag_) { - LOG(INFO) << "GOT SELF MESSAGE"; + LOG(INFO) << "Receive self-message"; return stop(); } } @@ -360,7 +360,7 @@ class CheckTestA final : public TestClinetTask { LOG_CHECK(text > previous_text_) << td::tag("now", text) << td::tag("previous", previous_text_); previous_text_ = text; cnt_--; - LOG(INFO) << "GOT " << td::tag("text", text) << td::tag("left", cnt_); + LOG(INFO) << "Receive " << td::tag("text", text) << td::tag("left", cnt_); if (cnt_ == 0) { return stop(); } @@ -427,7 +427,7 @@ class TestSecretChat final : public TestClinetTask { update_secret_chat->secret_chat_->state_->get_id() != td::td_api::secretChatStateReady::ID) { return; } - LOG(INFO) << "SEND ENCRYPTED MESSAGES"; + LOG(INFO) << "Send encrypted messages"; for (int i = 0; i < 20; i++) { send_query( td::make_tl_object( @@ -482,7 +482,7 @@ class TestFileGenerated final : public TestClinetTask { } void one_file() { - LOG(ERROR) << "Start ONE_FILE test"; + LOG(ERROR) << "Start one_file test"; auto file_path = PSTRING() << "test_documents" << TD_DIR_SLASH << "a.txt"; td::mkpath(file_path).ensure(); auto raw_file = @@ -554,7 +554,7 @@ class TestFileGenerated final : public TestClinetTask { } } auto ready = std::ftell(to); - LOG(ERROR) << "READY: " << ready; + LOG(ERROR) << "Ready: " << ready; parent_->send_query(td::make_tl_object( id_, 1039823 /*yeah, exact size of this file*/, td::narrow_cast(ready)), [](auto result) { check_td_error(result); }); @@ -631,7 +631,7 @@ class CheckTestC final : public TestClinetTask { auto text = messageDocument->caption_->text_; if (text.substr(0, tag_.size()) == tag_) { file_id_to_check_ = messageDocument->document_->document_->id_; - LOG(ERROR) << "GOT FILE " << to_string(messageDocument->document_->document_); + LOG(ERROR) << "Receive file " << to_string(messageDocument->document_->document_); send_query(td::make_tl_object(file_id_to_check_, 1, 0, 0, false), [](auto res) { check_td_error(res); }); }