add:添加可查询自己ID和所处位置的命令Who和Where。
This commit is contained in:
parent
ea1c7bb631
commit
e41876f063
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"files.autoSave": "onFocusChange",
|
"files.autoSave": "onFocusChange",
|
||||||
"editor.fontSize": 14,
|
"editor.fontSize": 14,
|
||||||
"editor.fontFamily": "'Source Code Pro', 'Source Code Pro', monospace",
|
"editor.fontFamily": "'FiraCode Nerd Font Mono', 'FiraCode Nerd Font Mono', 'FiraCode Nerd Font Mono'",
|
||||||
"terminal.integrated.fontFamily": "Source Code Pro",
|
"terminal.integrated.fontFamily": "FiraCode Nerd Font Mono",
|
||||||
"editor.fontLigatures": true,
|
"editor.fontLigatures": true,
|
||||||
//"C_Cpp.default.configurationProvider": "tboox.xmake-vscode",
|
//"C_Cpp.default.configurationProvider": "tboox.xmake-vscode",
|
||||||
"cmake.configureOnOpen": true,
|
"cmake.configureOnOpen": true,
|
||||||
@ -151,7 +151,8 @@
|
|||||||
"hash_map": "cpp",
|
"hash_map": "cpp",
|
||||||
"stdfloat": "cpp",
|
"stdfloat": "cpp",
|
||||||
"unordered_set": "cpp",
|
"unordered_set": "cpp",
|
||||||
"cfenv": "cpp"
|
"cfenv": "cpp",
|
||||||
|
"cassert": "cpp"
|
||||||
},
|
},
|
||||||
"makefile.configureOnOpen": false,
|
"makefile.configureOnOpen": false,
|
||||||
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
|
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
|
||||||
|
@ -66,7 +66,8 @@ void CClient::run(const std::string& ip, const std::string& port)
|
|||||||
delete bf;
|
delete bf;
|
||||||
TLOGI(log_, "version: {}", VERSION_NUM);
|
TLOGI(log_, "version: {}", VERSION_NUM);
|
||||||
TLOGI(log_, "opensource: {}", VERSION_URL);
|
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('|');
|
fc_append('|');
|
||||||
|
|
||||||
while (1) {
|
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));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
break;
|
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") {
|
if (cmd_input == "Get" || cmd_input == "get") {
|
||||||
get_task_list();
|
get_task_list();
|
||||||
continue;
|
continue;
|
||||||
@ -534,7 +543,7 @@ void CClient::handle_frame(CFrameBuffer* buf)
|
|||||||
}
|
}
|
||||||
switch (buf->type_) {
|
switch (buf->type_) {
|
||||||
case TYPE_GET_ID: {
|
case TYPE_GET_ID: {
|
||||||
TLOGD(log_, "Your ID:{}", buf->tid_);
|
TLOGD(log_, "ID => {}", buf->tid_);
|
||||||
own_id_ = buf->tid_;
|
own_id_ = buf->tid_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -576,11 +585,16 @@ void CClient::handle_frame(CFrameBuffer* buf)
|
|||||||
task_list_[index]->id = id;
|
task_list_[index]->id = id;
|
||||||
}
|
}
|
||||||
if (num < 20) {
|
if (num < 20) {
|
||||||
TLOGD(log_, "*****************************************");
|
TLOGD(log_, "============================================");
|
||||||
|
if (id == own_id_) {
|
||||||
|
TLOGI(log_, "@{}", real);
|
||||||
|
|
||||||
|
} else {
|
||||||
TLOGI(log_, "{}", real);
|
TLOGI(log_, "{}", real);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (num >= 20) {
|
if (num >= 20) {
|
||||||
TLOGW(log_, "Too Many Files [{}], Only Display 20.", num);
|
TLOGW(log_, "Too Many Files [{}], Only Display 20.", num);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ CFrameBuffer::~CFrameBuffer()
|
|||||||
Log_t get_logger(const std::string& mark)
|
Log_t get_logger(const std::string& mark)
|
||||||
{
|
{
|
||||||
auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
|
auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
|
||||||
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<spdlog::logger>(mark, console_sink);
|
auto logger = std::make_shared<spdlog::logger>(mark, console_sink);
|
||||||
logger->set_level(spdlog::level::debug);
|
logger->set_level(spdlog::level::debug);
|
||||||
spdlog::register_logger(logger);
|
spdlog::register_logger(logger);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user