mirror of https://github.com/aria2/aria2
2007-06-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Changed format of log file. * src/SimpleLogger.ccpull/1/head
parent
cdbfde719e
commit
ba6e5ac7e5
|
@ -1,3 +1,8 @@
|
|||
2007-06-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Changed format of log file.
|
||||
* src/SimpleLogger.cc
|
||||
|
||||
2007-06-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
* src/AbstractCommand.cc
|
||||
|
|
|
@ -201,7 +201,7 @@ void BtPieceMessage::onNewPiece(const PieceHandle& piece) {
|
|||
}
|
||||
|
||||
void BtPieceMessage::onWrongPiece(const PieceHandle& piece) {
|
||||
logger->error(MSG_GOT_WRONG_PIECE, cuid, piece->getIndex());
|
||||
logger->info(MSG_GOT_WRONG_PIECE, cuid, piece->getIndex());
|
||||
erasePieceOnDisk(piece);
|
||||
piece->clearAllBlock();
|
||||
requestFactory->removeTargetPiece(piece);
|
||||
|
|
|
@ -105,10 +105,9 @@ void RequestGroupMan::showDownloadResults(ostream& o) const
|
|||
<<_("Download Results:") << "\n"
|
||||
<< "idx|stat|path/URI" << "\n"
|
||||
<< "===+====+======================================================================" << "\n";
|
||||
int32_t count = 0;
|
||||
for(RequestGroups::const_iterator itr = _requestGroups.begin();
|
||||
itr != _requestGroups.end(); ++itr) {
|
||||
o << setw(3) << ++count << "|";
|
||||
o << setw(3) << (*itr)->getGID() << "|";
|
||||
if((*itr)->downloadFinished()) {
|
||||
o << "OK ";
|
||||
} else {
|
||||
|
|
|
@ -81,7 +81,7 @@ void SimpleLogger::setStdout(int level, bool enabled) {
|
|||
}
|
||||
|
||||
void SimpleLogger::writeHeader(FILE* file, string date, string level) const {
|
||||
fprintf(file, "%s - %s - ", date.c_str(), level.c_str());
|
||||
fprintf(file, "%s %s - ", date.c_str(), level.c_str());
|
||||
}
|
||||
|
||||
void SimpleLogger::writeLog(FILE* file, int level, const char* msg, va_list ap, Exception* e, bool printHeader) const
|
||||
|
@ -105,9 +105,11 @@ void SimpleLogger::writeLog(FILE* file, int level, const char* msg, va_list ap,
|
|||
levelStr = "INFO";
|
||||
}
|
||||
time_t now = time(NULL);
|
||||
char datestr[26];
|
||||
ctime_r(&now, datestr);
|
||||
datestr[strlen(datestr)-1] = '\0';
|
||||
char datestr[20];
|
||||
struct tm tm;
|
||||
localtime_r(&now, &tm);
|
||||
strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", &tm);
|
||||
|
||||
// TODO a quick hack not to print header in console
|
||||
if(printHeader) {
|
||||
writeHeader(file, datestr, levelStr);
|
||||
|
@ -127,7 +129,7 @@ void SimpleLogger::writeFile(int level, const char* msg, va_list ap, Exception*
|
|||
writeLog(file, level, msg, ap, e);
|
||||
if(stdoutField&level) {
|
||||
fprintf(stdout, "\n");
|
||||
writeLog(stdout, level, msg, ap, e, false);
|
||||
writeLog(stdout, level, msg, ap, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class SimpleLogger:public Logger {
|
|||
private:
|
||||
void writeFile(int level, const char* msg, va_list ap, Exception* e = 0) const;
|
||||
void writeHeader(FILE* file, string date, string level) const;
|
||||
void writeLog(FILE* file, int level, const char* msg, va_list ap, Exception* e = 0, bool printHeader = false) const;
|
||||
void writeLog(FILE* file, int level, const char* msg, va_list ap, Exception* e = 0, bool printHeader = true) const;
|
||||
FILE* file;
|
||||
int stdoutField;
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue