Add time to logging
This commit is contained in:
parent
eaae954e1b
commit
934954092a
11
main.cpp
11
main.cpp
@ -119,6 +119,15 @@ void treatComment(json comment)
|
||||
commentsCount++;
|
||||
}
|
||||
|
||||
string getDate()
|
||||
{
|
||||
auto t = time(nullptr);
|
||||
auto tm = *localtime(&t);
|
||||
ostringstream toString;
|
||||
toString << put_time(&tm, "%d-%m-%Y %H-%M-%S");
|
||||
return toString.str();
|
||||
}
|
||||
|
||||
vector<string> getFileContent(string filePath)
|
||||
{
|
||||
vector<string> lines;
|
||||
@ -139,7 +148,7 @@ json getJson(string url)
|
||||
|
||||
void print(ostringstream* toPrint)
|
||||
{
|
||||
cout << toPrint->str() << endl;
|
||||
cout << getDate() << ": " << toPrint->str() << endl;
|
||||
toPrint->str("");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user