mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-12-29 13:45:49 +01:00
Improve query logging.
This commit is contained in:
parent
95ff757c73
commit
e58e8d3989
@ -43,7 +43,7 @@ Query::Query(td::vector<td::BufferSlice> &&container, td::Slice token, bool is_t
|
||||
}
|
||||
td::to_lower_inplace(method_);
|
||||
start_timestamp_ = td::Time::now();
|
||||
LOG(INFO) << "QUERY: create " << td::tag("ptr", this) << *this;
|
||||
LOG(INFO) << "Query " << this << ": " << *this;
|
||||
if (shared_data_) {
|
||||
shared_data_->query_count_.fetch_add(1, std::memory_order_relaxed);
|
||||
if (method_ != "getupdates") {
|
||||
@ -85,7 +85,7 @@ void Query::set_stat_actor(td::ActorId<BotStatActor> stat_actor) {
|
||||
|
||||
void Query::set_ok(td::BufferSlice result) {
|
||||
CHECK(state_ == State::Query);
|
||||
LOG(INFO) << "QUERY: got ok " << td::tag("ptr", this) << td::tag("text", result.as_slice());
|
||||
LOG(INFO) << "Query " << this << ": " << td::tag("method", method_) << td::tag("text", result.as_slice());
|
||||
answer_ = std::move(result);
|
||||
state_ = State::OK;
|
||||
http_status_code_ = 200;
|
||||
@ -93,7 +93,7 @@ void Query::set_ok(td::BufferSlice result) {
|
||||
}
|
||||
|
||||
void Query::set_error(int http_status_code, td::BufferSlice result) {
|
||||
LOG(INFO) << "QUERY: got error " << td::tag("ptr", this) << td::tag("code", http_status_code)
|
||||
LOG(INFO) << "Query " << this << ": " << td::tag("method", method_) << td::tag("code", http_status_code)
|
||||
<< td::tag("text", result.as_slice());
|
||||
CHECK(state_ == State::Query);
|
||||
answer_ = std::move(result);
|
||||
@ -115,7 +115,7 @@ td::StringBuilder &operator<<(td::StringBuilder &sb, const Query &query) {
|
||||
auto padded_time =
|
||||
td::lpad(PSTRING() << td::format::as_time(td::Time::now_cached() - query.start_timestamp()), 10, ' ');
|
||||
sb << "[bot" << td::rpad(query.token().str(), 46, ' ') << "][time:" << padded_time << ']'
|
||||
<< td::tag("method", td::lpad(query.method().str(), 20, ' '));
|
||||
<< td::tag("method", td::lpad(query.method().str(), 25, ' '));
|
||||
if (!query.args().empty()) {
|
||||
sb << '{';
|
||||
for (const auto &arg : query.args()) {
|
||||
|
Loading…
Reference in New Issue
Block a user