add colors at Name: + fix error with missing 0 at time

This commit is contained in:
Markus 2020-02-23 22:20:39 +01:00
parent 2983c74858
commit bf3a6661a5
3 changed files with 13 additions and 12 deletions

View File

@ -24,8 +24,10 @@ int Logger::logCommandLine(std::string logText)
std::time_t now = std::time(nullptr); std::time_t now = std::time(nullptr);
struct tm *tm_now = localtime(&now); struct tm *tm_now = localtime(&now);
std::string date((tm_now->tm_mday < 10 ? "0" : "") + std::to_string(tm_now->tm_mday) + "." + std::string date((tm_now->tm_mday < 10 ? "0" : "") + std::to_string(tm_now->tm_mday) + "." +
(tm_now->tm_mon +1 < 10 ? "0" : "" ) + std::to_string(tm_now->tm_mon +1) + "." (tm_now->tm_mon +1 < 10 ? "0" : "" ) + std::to_string(tm_now->tm_mon +1) + "." +
+ std::to_string(1900 + tm_now->tm_year) + " - " + std::to_string(tm_now->tm_hour) + ":" + std::to_string(tm_now->tm_min)); std::to_string(1900 + tm_now->tm_year) + " - " +
(tm_now->tm_hour < 10 ? "0" : "" ) + std::to_string(tm_now->tm_hour) +
(tm_now->tm_min < 10 ? "0" : "" ) + ":" + std::to_string(tm_now->tm_min));
return writetoFile( " -> " + date + ": \"" + logText + "\""); return writetoFile( " -> " + date + ": \"" + logText + "\"");
} }



View File

@ -1512,23 +1512,22 @@ int unterOption_printLogFile(Settings *settings, int argc, char **argv)


// Main-Program:...... // Main-Program:......


std::string green = ((settings->colorless) ? "" : "\033[92m"), std::string clearColor = "\033[0m";
pink = ((settings->colorless) ? "" : "\033[95m"),
orange =((settings->colorless) ? "" : "\033[33m"),
blue = ((settings->colorless) ? "" : "\033[94m"),
clearColor = ((settings->colorless) ? "" : "\033[0m");


if(printMode && settings->colorless) if(printMode && settings->colorless)
std::cout << Logger(settings->logFilePath).getLogText() << std::endl; std::cout << Logger(settings->logFilePath).getLogText() << std::endl;
else if(printMode) { else if(printMode) {
std::string text = settings->logFilePath + ":\n" + Logger(settings->logFilePath).getLogText(); std::string text = settings->logFilePath + ":\n" + Logger(settings->logFilePath).getLogText();
//Command Lines //Command Lines
text = replace(text, ": \"", clearColor + ": " + blue + "\""); text = replace(text, ": \"", clearColor + ": " + "\033[94m" + "\"");
text = replace(text, "\n -> ", "\n -> " + pink ); text = replace(text, "\n -> ", std::string("\n -> ")+ "\033[95m" );


//Good Links //Good Links
text = replace(text, ": http", clearColor + ": " + green + "http"); text = replace(text, ": http", clearColor + ": " + "\033[92m" + "http");
text = replace(text, "\nS", "\n" + orange + "S"); text = replace(text, "\nS", std::string("\n" ) + "\033[33m" + "S");

//Names:
text = replace(text, "\nName: ", "\n" + std::string("\033[93m") + "Name: " + std::string("\033[96m"));


//Line/ Text - End //Line/ Text - End
text = replace(text, "\n", "\n" + clearColor); text = replace(text, "\n", "\n" + clearColor);

View File

@ -83,7 +83,7 @@ struct Settings {
proxy_ip = "127.0.0.1", proxy_ip = "127.0.0.1",
languages = "GerDub,GerSub,Eng,", languages = "GerDub,GerSub,Eng,",
genaueHoster = "", genaueHoster = "",
version = "3.9.2", version = "3.9.3",
defaultFileVersion="1.8", defaultFileVersion="1.8",
default_checkPath = "", default_checkPath = "",
default_Searchmuster = "S%Staffel%E%Folge%"; default_Searchmuster = "S%Staffel%E%Folge%";