Move log tags definitions out of logging.cpp.
GitOrigin-RevId: 0e74b94ec194f8ee678bb77a04d35df46702b330
This commit is contained in:
parent
c9c19f3399
commit
d2d0cb5cc0
@ -32,6 +32,9 @@
|
||||
#include <type_traits>
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(mtproto) = VERBOSITY_NAME(DEBUG) + 7;
|
||||
|
||||
namespace mtproto_api {
|
||||
|
||||
const int32 msg_container::ID;
|
||||
|
@ -25,6 +25,9 @@
|
||||
#include <utility>
|
||||
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(mtproto);
|
||||
|
||||
namespace mtproto_api {
|
||||
|
||||
class rpc_error;
|
||||
|
@ -21,6 +21,9 @@
|
||||
#include <tuple>
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(raw_mtproto) = VERBOSITY_NAME(DEBUG) + 10;
|
||||
|
||||
namespace mtproto {
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
@ -17,6 +17,9 @@
|
||||
#include <utility>
|
||||
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(raw_mtproto);
|
||||
|
||||
namespace mtproto {
|
||||
|
||||
class AuthKey;
|
||||
|
@ -6,23 +6,33 @@
|
||||
//
|
||||
#include "td/telegram/Logging.h"
|
||||
|
||||
#include "td/mtproto/SessionConnection.h"
|
||||
#include "td/mtproto/Transport.h"
|
||||
|
||||
#include "td/telegram/ConfigManager.h"
|
||||
#include "td/telegram/FileReferenceManager.h"
|
||||
#include "td/telegram/files/FileGcWorker.h"
|
||||
#include "td/telegram/files/FileLoaderUtils.h"
|
||||
#include "td/telegram/files/FileManager.h"
|
||||
#include "td/telegram/net/ConnectionCreator.h"
|
||||
#include "td/telegram/net/DcAuthManager.h"
|
||||
#include "td/telegram/net/NetQuery.h"
|
||||
#include "td/telegram/NotificationManager.h"
|
||||
#include "td/telegram/Td.h"
|
||||
#include "td/telegram/UpdatesManager.h"
|
||||
|
||||
#include "td/db/binlog/BinlogEvent.h"
|
||||
#include "td/db/SqliteStatement.h"
|
||||
|
||||
#include "td/net/GetHostByNameActor.h"
|
||||
#include "td/net/TransparentProxy.h"
|
||||
|
||||
#include "td/actor/actor.h"
|
||||
|
||||
#include "td/utils/FileLog.h"
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/misc.h"
|
||||
#include "td/utils/port/detail/NativeFd.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
|
@ -138,6 +138,9 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(td_init) = VERBOSITY_NAME(DEBUG) + 3;
|
||||
int VERBOSITY_NAME(td_requests) = VERBOSITY_NAME(INFO);
|
||||
|
||||
void Td::ResultHandler::set_td(Td *new_td) {
|
||||
CHECK(td == nullptr);
|
||||
td = new_td;
|
||||
@ -4132,8 +4135,6 @@ class Td::UploadFileCallback : public FileManager::UploadCallback {
|
||||
}
|
||||
};
|
||||
|
||||
int VERBOSITY_NAME(td_init) = VERBOSITY_NAME(DEBUG) + 3;
|
||||
|
||||
template <class T>
|
||||
void Td::complete_pending_preauthentication_requests(const T &func) {
|
||||
for (auto &request : pending_preauthentication_requests_) {
|
||||
|
@ -77,6 +77,7 @@ class WebPagesManager;
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(td_init);
|
||||
extern int VERBOSITY_NAME(td_requests);
|
||||
|
||||
// Td may start closing after explicit "close" or "destroy" query.
|
||||
// Or it may start closing by itself, because authorization is lost.
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "td/telegram/ClientActor.h"
|
||||
#include "td/telegram/Log.h"
|
||||
#include "td/telegram/td_api_json.h"
|
||||
#include "td/telegram/Td.h" // for VERBOSITY_NAME(td_requests)
|
||||
|
||||
#include "td/utils/base64.h"
|
||||
#include "td/utils/buffer.h"
|
||||
@ -4229,7 +4230,7 @@ class CliClient final : public Actor {
|
||||
LOG(ERROR) << r_cpu_stats.error();
|
||||
} else {
|
||||
auto stats = r_cpu_stats.move_as_ok();
|
||||
LOG(ERROR) << cpu_counter_ << ", total ticks = " << stats.total_ticks_
|
||||
LOG(ERROR) << cpu_counter_.load() << ", total ticks = " << stats.total_ticks_
|
||||
<< ", user ticks = " << stats.process_user_ticks_
|
||||
<< ", system ticks = " << stats.process_system_ticks_;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
#include "td/telegram/files/FileLoader.h"
|
||||
|
||||
#include "td/telegram/files/FileLoaderUtils.h"
|
||||
#include "td/telegram/files/ResourceManager.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/net/NetQueryDispatcher.h"
|
||||
@ -18,7 +19,6 @@
|
||||
#include "td/utils/ScopeGuard.h"
|
||||
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
namespace td {
|
||||
|
||||
|
@ -14,12 +14,11 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
class LocalFileLocation;
|
||||
class ResourceManager;
|
||||
|
||||
class FileLoaderActor : public NetQueryCallback {
|
||||
public:
|
||||
virtual void set_resource_manager(ActorShared<ResourceManager>) = 0;
|
||||
virtual void set_resource_manager(ActorShared<ResourceManager> resource_manager) = 0;
|
||||
virtual void update_priority(int8 priority) = 0;
|
||||
virtual void update_resources(const ResourceState &other) = 0;
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(files) = VERBOSITY_NAME(DEBUG) + 2;
|
||||
|
||||
namespace {
|
||||
Result<std::pair<FileFd, string>> try_create_new_file(Result<CSlice> result_name) {
|
||||
TRY_RESULT(name, std::move(result_name));
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(files);
|
||||
|
||||
Result<std::pair<FileFd, string>> open_temp_file(FileType file_type) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
Result<string> create_from_temp(CSlice temp_path, CSlice dir, CSlice name) TD_WARN_UNUSED_RESULT;
|
||||
|
@ -6,6 +6,8 @@
|
||||
//
|
||||
#include "td/telegram/files/PartsManager.h"
|
||||
|
||||
#include "td/telegram/files/FileLoaderUtils.h"
|
||||
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/misc.h"
|
||||
@ -150,12 +152,14 @@ bool PartsManager::unchecked_ready() {
|
||||
<< ", checked_prefix_size = " << checked_prefix_size_;
|
||||
return !unknown_size_flag_ && ready_size_ == size_;
|
||||
}
|
||||
|
||||
bool PartsManager::may_finish() {
|
||||
if (is_streaming_limit_reached()) {
|
||||
return true;
|
||||
}
|
||||
return ready();
|
||||
}
|
||||
|
||||
bool PartsManager::ready() {
|
||||
return unchecked_ready() && (!need_check_ || checked_prefix_size_ == size_);
|
||||
}
|
||||
@ -213,9 +217,11 @@ int32 PartsManager::get_ready_prefix_count() {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int64 PartsManager::get_streaming_offset() const {
|
||||
return streaming_offset_;
|
||||
}
|
||||
|
||||
string PartsManager::get_bitmask() {
|
||||
int32 prefix_count = -1;
|
||||
if (need_check_) {
|
||||
@ -399,6 +405,7 @@ int64 PartsManager::get_size() const {
|
||||
CHECK(!unknown_size_flag_);
|
||||
return size_;
|
||||
}
|
||||
|
||||
int64 PartsManager::get_size_or_zero() const {
|
||||
return size_;
|
||||
}
|
||||
@ -511,6 +518,7 @@ void PartsManager::set_checked_prefix_size(int64 size) {
|
||||
int64 PartsManager::get_checked_prefix_size() const {
|
||||
return checked_prefix_size_;
|
||||
}
|
||||
|
||||
int64 PartsManager::get_unchecked_ready_prefix_size() {
|
||||
update_first_not_ready_part();
|
||||
auto count = first_not_ready_part_;
|
||||
|
@ -6,6 +6,8 @@
|
||||
//
|
||||
#include "td/telegram/files/ResourceManager.h"
|
||||
|
||||
#include "td/telegram/files/FileLoaderUtils.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/logging.h"
|
||||
@ -159,6 +161,7 @@ void ResourceManager::loop() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ResourceManager::add_node(NodeId node_id, int8 priority) {
|
||||
if (priority >= 0) {
|
||||
auto it = std::find_if(to_xload_.begin(), to_xload_.end(), [&](auto &x) { return x.first <= priority; });
|
||||
@ -168,6 +171,7 @@ void ResourceManager::add_node(NodeId node_id, int8 priority) {
|
||||
to_xload_.insert(it, std::make_pair(narrow_cast<int8>(-priority), node_id));
|
||||
}
|
||||
}
|
||||
|
||||
bool ResourceManager::remove_node(NodeId node_id) {
|
||||
auto it = std::find_if(to_xload_.begin(), to_xload_.end(), [&](auto &x) { return x.second == node_id; });
|
||||
if (it != to_xload_.end()) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <utility>
|
||||
|
||||
namespace td {
|
||||
|
||||
class ResourceManager : public Actor {
|
||||
public:
|
||||
enum class Mode : int32 { Baseline, Greedy };
|
||||
@ -64,4 +65,5 @@ class ResourceManager : public Actor {
|
||||
void add_node(NodeId node_id, int8 priority);
|
||||
bool remove_node(NodeId node_id);
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(dc) = VERBOSITY_NAME(DEBUG) + 2;
|
||||
|
||||
DcAuthManager::DcAuthManager(ActorShared<> parent) {
|
||||
parent_ = std::move(parent);
|
||||
auto s_main_dc_id = G()->td_db()->get_binlog_pmc()->get("main_dc_id");
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(dc);
|
||||
|
||||
class DcAuthManager : public NetQueryCallback {
|
||||
public:
|
||||
explicit DcAuthManager(ActorShared<> parent);
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(net_query) = VERBOSITY_NAME(INFO);
|
||||
|
||||
int32 NetQuery::get_my_id() {
|
||||
return G()->get_my_id();
|
||||
}
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(net_query);
|
||||
|
||||
class NetQuery;
|
||||
using NetQueryPtr = ObjectPool<NetQuery>::OwnerPtr;
|
||||
using NetQueryRef = ObjectPool<NetQuery>::WeakPtr;
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "td/telegram/DhCache.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/net/DcAuthManager.h"
|
||||
#include "td/telegram/net/DcId.h"
|
||||
#include "td/telegram/net/MtprotoHeader.h"
|
||||
#include "td/telegram/net/NetQuery.h"
|
||||
|
@ -32,6 +32,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(actor);
|
||||
|
||||
class ActorInfo;
|
||||
|
||||
enum class ActorSendType { Immediate, Later, LaterWeak };
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(actor) = VERBOSITY_NAME(DEBUG) + 10;
|
||||
|
||||
TD_THREAD_LOCAL Scheduler *Scheduler::scheduler_; // static zero-initialized
|
||||
TD_THREAD_LOCAL ActorContext *Scheduler::context_; // static zero-initialized
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(sqlite) = VERBOSITY_NAME(DEBUG) + 10;
|
||||
|
||||
namespace {
|
||||
int printExplainQueryPlan(StringBuilder &sb, sqlite3_stmt *pStmt) {
|
||||
const char *zSql = sqlite3_sql(pStmt);
|
||||
|
@ -20,6 +20,8 @@ struct sqlite3_stmt;
|
||||
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(sqlite);
|
||||
|
||||
class SqliteStatement {
|
||||
public:
|
||||
SqliteStatement() = default;
|
||||
|
@ -29,16 +29,6 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(net_query) = VERBOSITY_NAME(INFO);
|
||||
int VERBOSITY_NAME(td_requests) = VERBOSITY_NAME(INFO);
|
||||
int VERBOSITY_NAME(dc) = VERBOSITY_NAME(DEBUG) + 2;
|
||||
int VERBOSITY_NAME(files) = VERBOSITY_NAME(DEBUG) + 2;
|
||||
int VERBOSITY_NAME(mtproto) = VERBOSITY_NAME(DEBUG) + 7;
|
||||
int VERBOSITY_NAME(raw_mtproto) = VERBOSITY_NAME(DEBUG) + 10;
|
||||
int VERBOSITY_NAME(fd) = VERBOSITY_NAME(DEBUG) + 9;
|
||||
int VERBOSITY_NAME(actor) = VERBOSITY_NAME(DEBUG) + 10;
|
||||
int VERBOSITY_NAME(sqlite) = VERBOSITY_NAME(DEBUG) + 10;
|
||||
|
||||
LogOptions log_options;
|
||||
|
||||
TD_THREAD_LOCAL const char *Logger::tag_ = nullptr;
|
||||
|
@ -109,16 +109,6 @@ constexpr int VERBOSITY_NAME(DEBUG) = 4;
|
||||
constexpr int VERBOSITY_NAME(NEVER) = 1024;
|
||||
|
||||
namespace td {
|
||||
// TODO Not part of utils. Should be in some separate file
|
||||
extern int VERBOSITY_NAME(mtproto);
|
||||
extern int VERBOSITY_NAME(raw_mtproto);
|
||||
extern int VERBOSITY_NAME(dc);
|
||||
extern int VERBOSITY_NAME(fd);
|
||||
extern int VERBOSITY_NAME(net_query);
|
||||
extern int VERBOSITY_NAME(td_requests);
|
||||
extern int VERBOSITY_NAME(actor);
|
||||
extern int VERBOSITY_NAME(files);
|
||||
extern int VERBOSITY_NAME(sqlite);
|
||||
|
||||
struct LogOptions {
|
||||
std::atomic<int> level{VERBOSITY_NAME(DEBUG) + 1};
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/Status.h"
|
||||
|
||||
#if TD_PORT_POSIX
|
||||
#include <fcntl.h>
|
||||
@ -22,6 +21,8 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
int VERBOSITY_NAME(fd) = VERBOSITY_NAME(DEBUG) + 9;
|
||||
|
||||
#if TD_FD_DEBUG
|
||||
class FdSet {
|
||||
public:
|
||||
|
@ -9,11 +9,14 @@
|
||||
#include "td/utils/port/config.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/Status.h"
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
extern int VERBOSITY_NAME(fd);
|
||||
|
||||
class NativeFd {
|
||||
public:
|
||||
#if TD_PORT_POSIX
|
||||
|
Loading…
Reference in New Issue
Block a user