update cdlog

This commit is contained in:
侯歌 2022-02-18 17:35:36 +08:00
parent d63629f0e3
commit af0db0cc24
4 changed files with 10 additions and 6 deletions

View File

@ -350,7 +350,7 @@ ColorStateList* Assets::getColorStateList(const std::string&fullresid){
realName=mTheme.getString(realName);
it=mColors.find(realName);
}
LOGV_IF(it!=mColors.end(),"%s[%s]type=%d",fullresid.c_str(),realName.c_str(),it->second.index());
LOGV_IF(it!=mColors.end(),"%s type=%d",fullresid.c_str(),it->second.index());
LOGV_IF(it==mColors.end(),"%s not found",fullresid.c_str());
if(it!=mColors.end()){
switch(it->second.index()){

View File

@ -32,7 +32,7 @@ int ZIPArchive::getEntries(std::vector<std::string>&entries)const{
return num;
}
int ZIPArchive::forEachEntry(std::function<bool(const std::string)>func)const{
int ZIPArchive::forEachEntry(std::function<bool(const std::string&)>func)const{
int count=0;
if(func){
const int num=zip_get_num_entries((zip_t*)zip,ZIP_FL_NODIR);

View File

@ -17,7 +17,7 @@ public:
~ZIPArchive();
void remove(const std::string&fname)const;
int getEntries(std::vector<std::string>&entries)const;
int forEachEntry(std::function<bool(const std::string)>fun)const;
int forEachEntry(std::function<bool(const std::string&)>fun)const;
bool hasEntry(const std::string&name,bool excludeDirectories=false)const;
std::istream* getInputStream(const std::string&fname)const;
void*getZipHandle(const std::string&fname)const;

View File

@ -25,10 +25,14 @@ static LogLevel sLogLevel=LOG_DEBUG;
static std::string splitFileName(const std::string& str) {
size_t found;
std::string result=str;
found = str.find_last_of("(/\\");
std::string result=str.substr(found + 1);
if(found!=std::string::npos)
result=str.substr(found + 1);
found = result.find_last_of(".");
return result.substr(0,found);
if(found!=std::string::npos)
return result.substr(0,found);
return result;
}
static std::map<const std::string,int>sModules;
@ -157,7 +161,7 @@ LogMessage::~LogMessage() {
if(level_>=module_loglevel){
oss << std::setw(10) <<std::setfill('0')<< (timestamp_) << "." << std::setw(6) << (timeusec_);
oss << " \033[0;32m[" << splitFileName(file_)<<"]\033[0;34m ";
oss << " \033[0;32m[" << file_<<"]\033[0;34m ";
oss << function_<<":" << line_ <<" "<<colors[level_];
const std::string str(stream_.str());