From e41876f063c52e5935b1c434ce83f9ef2562dbd6 Mon Sep 17 00:00:00 2001 From: taynpg Date: Tue, 25 Feb 2025 16:09:22 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E6=B7=BB=E5=8A=A0=E5=8F=AF?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=87=AA=E5=B7=B1ID=E5=92=8C=E6=89=80?= =?UTF-8?q?=E5=A4=84=E4=BD=8D=E7=BD=AE=E7=9A=84=E5=91=BD=E4=BB=A4Who?= =?UTF-8?q?=E5=92=8CWhere=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 7 ++++--- client/client.cpp | 22 ++++++++++++++++++---- util/util.cpp | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 73f7711..5f2a4bc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,8 @@ { "files.autoSave": "onFocusChange", "editor.fontSize": 14, - "editor.fontFamily": "'Source Code Pro', 'Source Code Pro', monospace", - "terminal.integrated.fontFamily": "Source Code Pro", + "editor.fontFamily": "'FiraCode Nerd Font Mono', 'FiraCode Nerd Font Mono', 'FiraCode Nerd Font Mono'", + "terminal.integrated.fontFamily": "FiraCode Nerd Font Mono", "editor.fontLigatures": true, //"C_Cpp.default.configurationProvider": "tboox.xmake-vscode", "cmake.configureOnOpen": true, @@ -151,7 +151,8 @@ "hash_map": "cpp", "stdfloat": "cpp", "unordered_set": "cpp", - "cfenv": "cpp" + "cfenv": "cpp", + "cassert": "cpp" }, "makefile.configureOnOpen": false, "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" diff --git a/client/client.cpp b/client/client.cpp index 39cfb18..b702999 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -66,7 +66,8 @@ void CClient::run(const std::string& ip, const std::string& port) delete bf; TLOGI(log_, "version: {}", VERSION_NUM); TLOGI(log_, "opensource: {}", VERSION_URL); - TLOGW(log_, "SupportCmd:Get|Up|Down|Cancel|Update"); + TLOGW(log_, "SupportCmd ==>"); + TLOGW(log_, "Get|Up|Down|Cancel|Update|Who|Where"); fc_append('|'); while (1) { @@ -87,6 +88,14 @@ void CClient::run(const std::string& ip, const std::string& port) std::this_thread::sleep_for(std::chrono::milliseconds(10)); break; } + if (cmd_input == "who" || cmd_input == "Who") { + TLOGD(log_, "ID => {}", own_id_); + continue; + } + if (cmd_input == "Where" || cmd_input == "where") { + TLOGD(log_, "At => {}", COfPath::to_full(".")); + continue; + } if (cmd_input == "Get" || cmd_input == "get") { get_task_list(); continue; @@ -534,7 +543,7 @@ void CClient::handle_frame(CFrameBuffer* buf) } switch (buf->type_) { case TYPE_GET_ID: { - TLOGD(log_, "Your ID:{}", buf->tid_); + TLOGD(log_, "ID => {}", buf->tid_); own_id_ = buf->tid_; break; } @@ -576,8 +585,13 @@ void CClient::handle_frame(CFrameBuffer* buf) task_list_[index]->id = id; } if (num < 20) { - TLOGD(log_, "*****************************************"); - TLOGI(log_, "{}", real); + TLOGD(log_, "============================================"); + if (id == own_id_) { + TLOGI(log_, "@{}", real); + + } else { + TLOGI(log_, "{}", real); + } } } } diff --git a/util/util.cpp b/util/util.cpp index 99b6c14..282ea9a 100644 --- a/util/util.cpp +++ b/util/util.cpp @@ -132,7 +132,7 @@ CFrameBuffer::~CFrameBuffer() Log_t get_logger(const std::string& mark) { auto console_sink = std::make_shared(); - console_sink->set_pattern("%^[%Y-%m-%d %H:%M:%S.%e]: %v%$"); + console_sink->set_pattern("%^[%m-%d %H:%M:%S.%e]: %v%$"); auto logger = std::make_shared(mark, console_sink); logger->set_level(spdlog::level::debug); spdlog::register_logger(logger);