rename:更改打印名称,避免冲突。

This commit is contained in:
taynpg 2025-01-21 15:58:10 +08:00
parent 3356ceee67
commit eabbc5dbec
5 changed files with 91 additions and 90 deletions

View File

@ -52,7 +52,7 @@ void CClient::run(const std::string& ip, const std::string& port)
{
th_run_ = true;
if (!client_->connect(ip, port)) {
pinfo("{} connect err.", __FUNCTION__);
mpinfo("{} connect err.", __FUNCTION__);
return;
}
client_->register_func([&](CFrameBuffer* buf) { handle_frame(buf); });
@ -65,7 +65,7 @@ void CClient::run(const std::string& ip, const std::string& port)
send_frame(bf);
delete bf;
pwarn("SupportCmd:Get|Up|Down|Cancel|Update");
mpwarn("SupportCmd:Get|Up|Down|Cancel|Update");
fc_append('|');
while (1) {
@ -74,7 +74,7 @@ void CClient::run(const std::string& ip, const std::string& port)
break;
}
if (!th_run_ || !client_->is_normal()) {
pwarn("The link has been closed and cannot be continued. It will automatically exit.");
mpwarn("The link has been closed and cannot be continued. It will automatically exit.");
break;
}
std::string cmd_input(readline);
@ -96,7 +96,7 @@ void CClient::run(const std::string& ip, const std::string& port)
}
auto vec = COfStr::split(cmd_input, " ");
if (vec.size() < 2) {
perror("No matched cmd, May be param size incorrect.");
mperror("No matched cmd, May be param size incorrect.");
continue;
}
std::string param(cmd_input);
@ -115,11 +115,11 @@ void CClient::run(const std::string& ip, const std::string& port)
up_task(param);
continue;
}
perror("No matched cmd, May be param size incorrect.");
mperror("No matched cmd, May be param size incorrect.");
}
client_->disconnect();
thread.join();
pinfo("{} exit.", __FUNCTION__);
mpinfo("{} exit.", __FUNCTION__);
}
bool CClient::get_task_list()
@ -132,17 +132,17 @@ bool CClient::get_task_list()
bool CClient::down_task(const std::string& param)
{
if (downloading_) {
pwarn("Have Task Downloading, Please wait.....");
mpwarn("Have Task Downloading, Please wait.....");
return false;
}
int id = std::stoi(param);
if (!task_list_.count(id)) {
perror("No matched id[{}] in task list.", id);
mperror("No matched id[{}] in task list.", id);
return false;
}
if (task_list_[id]->id == own_id_) {
pwarn("You can't down your own file!!!");
mpwarn("You can't down your own file!!!");
return false;
}
@ -150,7 +150,7 @@ bool CClient::down_task(const std::string& param)
down_ = std::make_shared<TransInfomation>();
if (vec.empty()) {
pwarn("No files List, Please Check!");
mpwarn("No files List, Please Check!");
return false;
}
@ -171,7 +171,7 @@ bool CClient::up_task(const std::string& param)
std::lock_guard<std::mutex> lock(mutex_);
for (const auto& item : up_) {
if (item.second->trans_state_ == TRANS_REDAY || item.second->trans_state_ == TRANS_ING) {
pwarn("Have Task Upping, Please wait!");
mpwarn("Have Task Upping, Please wait!");
return false;
}
}
@ -182,12 +182,12 @@ bool CClient::up_task(const std::string& param)
for (const auto& item : list) {
if (!fs::exists(item)) {
perror("File {} not exist, please check.", item);
mperror("File {} not exist, please check.", item);
return false;
}
if (!fs::is_regular_file(item)) {
perror("Only Support Up File, But directory.", item);
mperror("Only Support Up File, But directory.", item);
return false;
}
@ -198,7 +198,7 @@ bool CClient::up_task(const std::string& param)
}
}
if (msg.empty()) {
pwarn("{} msg empty.", __FUNCTION__);
mpwarn("{} msg empty.", __FUNCTION__);
return false;
}
@ -220,7 +220,7 @@ bool CClient::cancel_task()
std::lock_guard<std::mutex> lock(mutex_);
for (const auto& item : up_) {
if (item.second->trans_state_ == TRANS_REDAY || item.second->trans_state_ == TRANS_ING) {
pwarn("Have Task Upping, Please wait!");
mpwarn("Have Task Upping, Please wait!");
return false;
}
}
@ -247,10 +247,10 @@ bool CClient::down_one_file(const std::string& id, const std::string& file, cons
down_->cur_file_ = fs::path(local_dir).append(remote_file.filename().string()).string();
}
pwarn("Start Down => {} To {}", down_->cur_remote_file_, down_->cur_file_);
mpwarn("Start Down => {} To {}", down_->cur_remote_file_, down_->cur_file_);
down_->file_.open(down_->cur_file_, std::ios::out | std::ios::binary);
if (!down_->file_.is_open()) {
perror("Open {} Failed.", down_->cur_file_);
mperror("Open {} Failed.", down_->cur_file_);
return false;
}
@ -261,7 +261,7 @@ bool CClient::down_one_file(const std::string& id, const std::string& file, cons
buf->data_ = new char[file.size() + 1];
buf->len_ = std::snprintf(buf->data_, file.size() + 1, "%s", file.data());
if (!send_frame(buf.get())) {
perror("{} request open file [{}] send failed.", __FUNCTION__, down_->cur_remote_file_);
mperror("{} request open file [{}] send failed.", __FUNCTION__, down_->cur_remote_file_);
down_->cur_remote_id_.clear();
down_->cur_remote_file_.clear();
return false;
@ -277,7 +277,7 @@ bool CClient::down_one_file(const std::string& id, const std::string& file, cons
CTransProtocal::display_progress(percent);
}
if (!th_run_) {
perror("Interrup When Receive File.");
mperror("Interrup When Receive File.");
report_trans_ret(TRANS_FAILED);
return false;
}
@ -287,10 +287,11 @@ bool CClient::down_one_file(const std::string& id, const std::string& file, cons
CTransProtocal::display_progress(percent);
}
if (cur_file_size_ == cur_down_size_) {
pwarn("Trans done, close file {}, total:[{}/{}]", down_->cur_file_, cur_down_size_, cur_file_size_);
mpwarn("Trans done, close file {}, total:[{}/{}]", down_->cur_file_, cur_down_size_, cur_file_size_);
return true;
} else {
pwarn("Trans failed, close file {}, total:[{}/{}]", down_->cur_file_, cur_down_size_, cur_file_size_);
mpwarn("Trans failed, close file {}, total:[{}/{}]", down_->cur_file_, cur_down_size_,
cur_file_size_);
return false;
}
}
@ -335,31 +336,31 @@ bool CClient::request_update_list(const std::string& param)
{
auto tvec = COfStr::split(param, " ");
if (tvec.size() < 2) {
perror("{} invalid param format [{}]", __FUNCTION__, param);
mperror("{} invalid param format [{}]", __FUNCTION__, param);
return false;
}
int index = std::stoi(tvec[0]);
std::string list_file = tvec[1];
if (downloading_) {
pwarn("Have Task Downloading, Please wait.....");
mpwarn("Have Task Downloading, Please wait.....");
return false;
}
if (!task_list_.count(index)) {
perror("No Index Found {}.", index);
mperror("No Index Found {}.", index);
return false;
}
const auto& sr = task_list_[index];
if (sr->id == own_id_) {
pwarn("You can't update your own file!!!");
mpwarn("You can't update your own file!!!");
return false;
}
// 读取list文件
std::ifstream in(COfPath::to_full(list_file));
if (!in.is_open()) {
perror("Can't Open File:{}", COfPath::to_full(list_file));
mperror("Can't Open File:{}", COfPath::to_full(list_file));
return false;
}
std::istreambuf_iterator<char> iterf(in);
@ -376,11 +377,11 @@ bool CClient::request_update_list(const std::string& param)
if (hitem.empty()) {
continue;
}
pinfo("---> check {}", hitem);
mpinfo("---> check {}", hitem);
auto v = COfStr::split(hitem, "|");
if (v.size() >= 2) {
if (!fs::exists(v[0])) {
perror("file {} not exist.", v[0]);
mperror("file {} not exist.", v[0]);
valid = false;
break;
}
@ -392,7 +393,7 @@ bool CClient::request_update_list(const std::string& param)
}
if (!valid) {
perror("Judge List File {} Format Not Passed.", list_file);
mperror("Judge List File {} Format Not Passed.", list_file);
return false;
}
@ -404,7 +405,7 @@ bool CClient::request_update_list(const std::string& param)
buf->tid_ = task_list_[index]->id;
if (!send_frame(buf.get())) {
perror("Send Failed {}", __LINE__);
mperror("Send Failed {}", __LINE__);
return false;
}
return true;
@ -420,13 +421,13 @@ bool CClient::check_update_list(const std::string& content, std::map<std::string
}
auto vi = COfStr::split(item, "|");
if (vi.size() != 2) {
perror("Size not 2 {}", item);
mperror("Size not 2 {}", item);
valid = true;
break;
}
if (!fs::exists(vi[1])) {
valid = false;
perror("Not exist {}", vi[1]);
mperror("Not exist {}", vi[1]);
break;
}
files[vi[0]] = vi[1];
@ -448,10 +449,10 @@ bool CClient::down_update_file(std::map<std::string, std::string> files)
}
if (suc) {
buf->type_ = TYPE_DONE_UPDATE_LIST;
pinfo("Do Task From {} Done!", buf->tid_);
mpinfo("Do Task From {} Done!", buf->tid_);
} else {
buf->type_ = TYPE_FAILED_UPDATE_LIST;
pinfo("Do Task From {} Failed!", buf->tid_);
mpinfo("Do Task From {} Failed!", buf->tid_);
}
send_frame(buf.get());
return suc;
@ -462,7 +463,7 @@ bool CClient::send_frame(CFrameBuffer* buf)
char* out_buf{};
int out_len{};
if (!CTransProtocal::pack(buf, &out_buf, out_len)) {
perror("{} pack failed.", __FUNCTION__);
mperror("{} pack failed.", __FUNCTION__);
return false;
}
std::lock_guard<std::mutex> lock(send_mut_);
@ -477,12 +478,12 @@ bool CClient::send_frame(CFrameBuffer* buf)
void CClient::handle_frame(CFrameBuffer* buf)
{
if (buf == nullptr) {
perror("{} nullptr.", __FUNCTION__);
mperror("{} nullptr.", __FUNCTION__);
return;
}
switch (buf->type_) {
case TYPE_GET_ID: {
pdebug("Your ID:{}", buf->tid_);
mpdebug("Your ID:{}", buf->tid_);
own_id_ = buf->tid_;
break;
}
@ -498,9 +499,9 @@ void CClient::handle_frame(CFrameBuffer* buf)
}
if (real.find("[") == std::string::npos) {
#ifdef _WIN32
pinfo("FILE ==> {}", CCodec::u8_to_ansi(real));
mpinfo("FILE ==> {}", CCodec::u8_to_ansi(real));
#else
pinfo("FILE ==> {}", real);
mpinfo("FILE ==> {}", real);
#endif
task_list_[index]->files.push_back(real);
} else {
@ -520,8 +521,8 @@ void CClient::handle_frame(CFrameBuffer* buf)
task_list_[index]->id = id;
}
pdebug("*****************************************");
pinfo("{}", real);
mpdebug("*****************************************");
mpinfo("{}", real);
}
}
break;
@ -536,7 +537,7 @@ void CClient::handle_frame(CFrameBuffer* buf)
down_->file_.write(buf->data_, buf->len_);
if (down_->file_.fail()) {
report_trans_ret(TRANS_FAILED);
pwarn("no matched write and data. {}", buf->len_);
mpwarn("no matched write and data. {}", buf->len_);
}
cur_down_size_ += buf->len_;
}
@ -555,7 +556,7 @@ void CClient::handle_frame(CFrameBuffer* buf)
up_[buf->fid_]->file_.open(up_[buf->fid_]->cur_file_, std::ios::in | std::ios::binary);
up_[buf->fid_]->trans_state_ = TRANS_REDAY;
if (!up_[buf->fid_]->file_.is_open()) {
perror("Ready Send File {} Open Failed.", up_[buf->fid_]->cur_file_);
mperror("Ready Send File {} Open Failed.", up_[buf->fid_]->cur_file_);
break;
}
keys = buf->fid_;
@ -573,7 +574,7 @@ void CClient::handle_frame(CFrameBuffer* buf)
if (buf->mark_) {
std::lock_guard<std::mutex> lock(mutex_);
if (!up_.count(buf->fid_)) {
pwarn("Offline no match.");
mpwarn("Offline no match.");
break;
}
auto t = up_[buf->fid_];
@ -581,7 +582,7 @@ void CClient::handle_frame(CFrameBuffer* buf)
break;
}
if (downloading_ && !down_->cur_remote_file_.empty()) {
pwarn("Stop Down {} From {}.", down_->cur_remote_file_, buf->fid_);
mpwarn("Stop Down {} From {}.", down_->cur_remote_file_, buf->fid_);
}
report_trans_ret(TRANS_FAILED);
break;
@ -597,14 +598,14 @@ void CClient::handle_frame(CFrameBuffer* buf)
}
std::swap(buf->tid_, buf->fid_);
if (!send_frame(buf)) {
perror("Send Failed {}.", __LINE__);
mperror("Send Failed {}.", __LINE__);
break;
}
if (buf->type_ == TYPE_UNCONFIRM_UPDATE_LIST) {
break;
}
list_serve_id_ = buf->tid_;
pdebug("Do Task From {}.", buf->tid_);
mpdebug("Do Task From {}.", buf->tid_);
if (update_list_th_.joinable()) {
update_list_th_.join();
}
@ -612,26 +613,26 @@ void CClient::handle_frame(CFrameBuffer* buf)
break;
}
case TYPE_CONFIRM_UPDATE_LIST: {
pinfo("remote {} check {} passed!", buf->fid_, list_file_);
mpinfo("remote {} check {} passed!", buf->fid_, list_file_);
break;
}
case TYPE_UNCONFIRM_UPDATE_LIST: {
perror("remote {} check {} not passed!", buf->fid_, list_file_);
mperror("remote {} check {} not passed!", buf->fid_, list_file_);
break;
}
case TYPE_DONE_UPDATE_LIST: {
pinfo("remote {} do task {} success!", buf->fid_, list_file_);
mpinfo("remote {} do task {} success!", buf->fid_, list_file_);
break;
}
case TYPE_FAILED_UPDATE_LIST: {
pinfo("remote {} do task {} failed!", buf->fid_, list_file_);
mpinfo("remote {} do task {} failed!", buf->fid_, list_file_);
break;
}
case TYPE_FILE_SIZE: {
std::string str_size(buf->data_, buf->len_);
long long size = std::stoll(str_size);
std::string show_str = OfUtil::get_file_size(size);
pinfo("Ready Down Size: {}", show_str);
mpinfo("Ready Down Size: {}", show_str);
cur_file_size_ = size;
}
default:
@ -647,13 +648,13 @@ void CClient::send_file_data_th(const char* keys)
{
std::lock_guard<std::mutex> lock(mutex_);
if (!up_.count(str_key)) {
perror("{} no matched key.", __FUNCTION__);
mperror("{} no matched key.", __FUNCTION__);
return;
}
t = up_[str_key];
}
pinfo("Start Trans File {} To {}", t->cur_file_, str_key);
mpinfo("Start Trans File {} To {}", t->cur_file_, str_key);
std::shared_ptr<CFrameBuffer> buf = std::make_shared<CFrameBuffer>();
buf->data_ = new char[g_BuffSize]{};
buf->tid_ = str_key;
@ -665,11 +666,11 @@ void CClient::send_file_data_th(const char* keys)
buf->type_ = TYPE_FILE_SIZE;
std::string str_size = std::to_string(size);
pinfo("To {} File Size: {} [{}]", str_key, ofen::OfUtil::get_file_size(size), size);
mpinfo("To {} File Size: {} [{}]", str_key, ofen::OfUtil::get_file_size(size), size);
buf->len_ = std::snprintf(buf->data_, g_BuffSize, "%s", str_size.c_str());
if (!send_frame(buf.get())) {
report_trans_ret(TRANS_FAILED, str_key);
perror("Stop Trans {} To {} failed.", t->cur_file_, str_key);
mperror("Stop Trans {} To {} failed.", t->cur_file_, str_key);
return;
}
buf->type_ = TYPE_TRANS_FILE;
@ -677,7 +678,7 @@ void CClient::send_file_data_th(const char* keys)
while (!t->file_.eof()) {
if (t->trans_state_ == TRANS_BREAK) {
pwarn("Stop Trans {} To {} failed.", t->cur_file_, str_key);
mpwarn("Stop Trans {} To {} failed.", t->cur_file_, str_key);
report_trans_ret(TRANS_FAILED, str_key);
return;
}
@ -685,7 +686,7 @@ void CClient::send_file_data_th(const char* keys)
buf->len_ = t->file_.gcount();
if (!send_frame(buf.get())) {
report_trans_ret(TRANS_FAILED, str_key);
perror("Stop Trans {} To {} failed.", t->cur_file_, str_key);
mperror("Stop Trans {} To {} failed.", t->cur_file_, str_key);
return;
}
// std::this_thread::sleep_for(std::chrono::milliseconds(10));
@ -693,10 +694,10 @@ void CClient::send_file_data_th(const char* keys)
buf->type_ = TYPE_TRANS_DONE;
if (!send_frame(buf.get())) {
perror("send_file_data_th send DONE failed.");
mperror("send_file_data_th send DONE failed.");
}
report_trans_ret(TRANS_DONE, str_key);
pdebug("Trans File {} To {} Done !!!", t->cur_file_, str_key);
mpdebug("Trans File {} To {} Done !!!", t->cur_file_, str_key);
}
void CClient::hearts()
@ -706,7 +707,7 @@ void CClient::hearts()
while (th_run_) {
sleep_.sleep();
if (th_run_ && !send_frame(buf.get())) {
perror("{} send failed.", __FUNCTION__);
mperror("{} send failed.", __FUNCTION__);
th_run_ = false;
}
}

View File

@ -26,7 +26,7 @@ bool CServerConfig::baseInit()
}
SI_Error ret = ini_handle_.LoadFile(config_path_.c_str());
if (ret != SI_OK) {
perror("Load Ini [{}] Failed.", config_path_);
mperror("Load Ini [{}] Failed.", config_path_);
return false;
}
init_ = true;
@ -38,7 +38,7 @@ bool CServerConfig::read_ini(std::vector<TransmSet>& set)
assert(init_ == true);
long groups = ini_handle_.GetLongValue("BASE", "GROUPS");
if (groups < 1) {
perror("GROUPS num < 1.");
mperror("GROUPS num < 1.");
return false;
}
set.clear();
@ -108,7 +108,7 @@ bool CServerConfig::get_ini(const std::vector<TransmSet>& set, long num, TransmS
void CServerConfig::gen_default_ini(const std::string& path)
{
pwarn("Gen Default Setting Ini in [{}].", path);
mpwarn("Gen Default Setting Ini in [{}].", path);
ini_handle_.LoadFile(path.c_str());
ini_handle_.SetLongValue("BASE", "GROUPS", 1);
ini_handle_.SetValue("GROUP0", "IP", "127.0.0.1");

View File

@ -52,7 +52,7 @@ bool exec_cmd(const CmdParam& param, bool& run)
return false;
}
for (const auto& item : set) {
pinfo("{} => {}:{}", item.group, item.ip, item.port);
mpinfo("{} => {}:{}", item.group, item.ip, item.port);
}
return true;
}
@ -61,34 +61,34 @@ bool exec_cmd(const CmdParam& param, bool& run)
return true;
}
if (!param.appendValue.empty() && !param.removeValue.empty()) {
perror("append and remove can't simultaneous operate!");
mperror("append and remove can't simultaneous operate!");
return false;
}
if (!param.appendValue.empty()) {
std::regex rg(R"(([^:]+):(\d+))");
std::smatch match;
if (!std::regex_search(param.appendValue, match, rg)) {
perror("append invalid format!");
mperror("append invalid format!");
return false;
}
std::string ip = match[1].str();
std::string port = match[2].str();
if (!g_Config->append_ini(ip, std::stol(port))) {
perror("add {}:{} failed.", ip, port);
mperror("add {}:{} failed.", ip, port);
return false;
}
pinfo("add {}:{} success.", ip, port);
mpinfo("add {}:{} success.", ip, port);
return true;
}
if (!param.removeValue.empty()) {
if (!g_Config->remove_ini(std::stol(param.removeValue))) {
perror("remove config num=[{}] failed, please check!", param.removeValue);
mperror("remove config num=[{}] failed, please check!", param.removeValue);
return false;
}
pinfo("remove config num=[{}] success!", param.removeValue);
mpinfo("remove config num=[{}] success!", param.removeValue);
return true;
}
perror("not matched!", param.removeValue);
mperror("not matched!", param.removeValue);
return false;
}
@ -115,7 +115,7 @@ int main(int argc, char* argv[])
return 0;
}
if (!exec_cmd(param, run)) {
perror("exec_cmd failed!");
mperror("exec_cmd failed!");
return -1;
}
if (!run) {
@ -128,13 +128,13 @@ int main(int argc, char* argv[])
}
TransmSet use;
if (!g_Config->get_ini(set, param.use_config, use)) {
perror("Not found config by num:[{}]", param.use_config);
mperror("Not found config by num:[{}]", param.use_config);
return -1;
}
pinfo("Build At {} {} under {} on {}", __DATE__, __TIME__, VERSION_GIT_COMMIT, VERSION_GIT_BRANCH);
pinfo("use ip => [{}], port => [{}]", use.ip, use.port);
mpinfo("Build At {} {} under {} on {}", __DATE__, __TIME__, VERSION_GIT_COMMIT, VERSION_GIT_BRANCH);
mpinfo("use ip => [{}], port => [{}]", use.ip, use.port);
CClient client;
client.run(use.ip, std::to_string(use.port));
pinfo("exit ==========");
mpinfo("exit ==========");
return 0;
}

View File

@ -14,11 +14,11 @@ bool CTcpClient::connect(const std::string& host, const std::string& port)
asio::ip::tcp::resolver resolver(io_context_);
asio::ip::tcp::resolver::results_type endpoints = resolver.resolve(host, port);
asio::connect(socket_, endpoints);
pinfo("Connected to {}:{}", host, port);
mpinfo("Connected to {}:{}", host, port);
is_normal_ = true;
return true;
} catch (const std::exception& ex) {
perror("Connection failed: {}", ex.what());
mperror("Connection failed: {}", ex.what());
return false;
}
}
@ -29,9 +29,9 @@ void CTcpClient::disconnect()
try {
socket_.shutdown(asio::ip::tcp::socket::shutdown_both);
socket_.close();
pinfo("Disconnected.");
mpinfo("Disconnected.");
} catch (const std::exception& ex) {
perror("Error during disconnection: {}", ex.what());
mperror("Error during disconnection: {}", ex.what());
}
}
}
@ -39,15 +39,15 @@ void CTcpClient::disconnect()
bool CTcpClient::send(const char* data, int len)
{
if (!is_normal_) {
perror("abnormal state, will not send.");
mperror("abnormal state, will not send.");
return false;
}
try {
auto send_size = asio::write(socket_, asio::buffer(data, len));
// pinfo("Need Send len: {} Real Send len: {}", len, send_size);
// mpinfo("Need Send len: {} Real Send len: {}", len, send_size);
return static_cast<int>(send_size) == len;
} catch (const std::exception& ex) {
perror("Send failed: {}", ex.what());
mperror("Send failed: {}", ex.what());
return false;
}
}
@ -68,10 +68,10 @@ void CTcpClient::async_recv()
return;
}
if (ec.value() == 125) {
pinfo("{} exit.", __FUNCTION__);
mpinfo("{} exit.", __FUNCTION__);
return;
}
perror("{} {} error => {}", __FUNCTION__, ec.value(), ec.message());
mperror("{} {} error => {}", __FUNCTION__, ec.value(), ec.message());
} else {
buffer_.push(tmp_buf_.data(), length);
while (true) {

View File

@ -93,19 +93,19 @@ inline std::string now_str()
return timestamp.str();
}
template <typename... Args> void pdebug(const std::string& format, Args&&... args)
template <typename... Args> void mpdebug(const std::string& format, Args&&... args)
{
fmt::print(fg(fmt::color::steel_blue), now_str() + format + "\n", std::forward<Args>(args)...);
}
template <typename... Args> void pinfo(const std::string& format, Args&&... args)
template <typename... Args> void mpinfo(const std::string& format, Args&&... args)
{
fmt::print(fg(fmt::color::gray), now_str() + format + "\n", std::forward<Args>(args)...);
}
template <typename... Args> void pwarn(const std::string& format, Args&&... args)
template <typename... Args> void mpwarn(const std::string& format, Args&&... args)
{
fmt::print(fg(fmt::color::yellow_green), now_str() + format + "\n", std::forward<Args>(args)...);
}
template <typename... Args> void perror(const std::string& format, Args&&... args)
template <typename... Args> void mperror(const std::string& format, Args&&... args)
{
fmt::print(fg(fmt::color::orange_red), now_str() + format + "\n", std::forward<Args>(args)...);
}