From 4c10d2ed2d4f44a186439403b81754e16f536d33 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Tue, 25 May 2021 23:19:54 +0800 Subject: [PATCH] no message --- general/src/loger.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/general/src/loger.cpp b/general/src/loger.cpp index bfb8161..520bc61 100644 --- a/general/src/loger.cpp +++ b/general/src/loger.cpp @@ -25,9 +25,9 @@ int _C_Loger::Debug(string dat,string function,int line){ // 还没有过天 if(getTimeDate() == this->mCurrentDate){ string tmp = getTime(); - tmp += ":"; + tmp += ": "; tmp += dat; - tmp += "at [" + function + " line " + std::to_string(line) + "]"; + tmp += "at [" + function + " line " + std::to_string(line) + "]"; tmp += "\n"; int ret =fwrite(tmp.c_str(),tmp.size(),1,this->mFile); fflush(this->mFile); @@ -40,9 +40,9 @@ int _C_Loger::Debug(string dat,string function,int line){ this->error = true; } string tmp = getTime(); - tmp += ":"; + tmp += ": "; tmp += dat; - tmp += "at [" + function + " line " + std::to_string(line) + "]"; + tmp += "at [" + function + " line " + std::to_string(line) + "]"; tmp += "\n"; int ret = fwrite(tmp.c_str(),tmp.size(),1,this->mFile); fflush(this->mFile); @@ -57,7 +57,7 @@ void _C_Loger::operator<<(const string& wb){ string tmp = getTime(); tmp += ":"; tmp += wb; - tmp += "\n"; + tmp += " \n"; fwrite(tmp.c_str(),tmp.size(),1,this->mFile); fflush(this->mFile); }else{ // 已经过天了 @@ -67,8 +67,14 @@ void _C_Loger::operator<<(const string& wb){ if (this->mFile == nullptr){ this->error = true; } + + string tmp = getTime(); + tmp += ":"; + tmp += wb; + tmp += " \n"; + fwrite(tmp.c_str(),tmp.size(),1,this->mFile); + fflush(this->mFile); } - fprintf(this->mFile,wb.c_str(),wb.size()); } bool file_existed(string path) {