зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1902690 - Add timestamps to output using LOG_WARN r=nalexander,application-update-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D214211
This commit is contained in:
Родитель
4171a32712
Коммит
fe840f78bc
|
@ -129,7 +129,7 @@ void UpdateLog::Flush() {
|
|||
fflush(logFP);
|
||||
}
|
||||
|
||||
void UpdateLog::Printf(const char* fmt, ...) {
|
||||
void UpdateLog::PrintTimestampPrefix() {
|
||||
if (!logFP) {
|
||||
return;
|
||||
}
|
||||
|
@ -152,6 +152,14 @@ void UpdateLog::Printf(const char* fmt, ...) {
|
|||
|
||||
fprintf(logFP, "%s: ", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateLog::Printf(const char* fmt, ...) {
|
||||
if (!logFP) {
|
||||
return;
|
||||
}
|
||||
|
||||
PrintTimestampPrefix();
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -159,11 +167,9 @@ void UpdateLog::Printf(const char* fmt, ...) {
|
|||
va_end(ap);
|
||||
|
||||
fprintf(logFP, "\n");
|
||||
#if defined(XP_WIN) && defined(MOZ_DEBUG)
|
||||
// When the updater crashes on Windows the log file won't be flushed and this
|
||||
// can make it easier to debug what is going on.
|
||||
fflush(logFP);
|
||||
#endif
|
||||
}
|
||||
|
||||
void UpdateLog::WarnPrintf(const char* fmt, ...) {
|
||||
|
@ -171,17 +177,17 @@ void UpdateLog::WarnPrintf(const char* fmt, ...) {
|
|||
return;
|
||||
}
|
||||
|
||||
PrintTimestampPrefix();
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
fprintf(logFP, "*** Warning: ");
|
||||
vfprintf(logFP, fmt, ap);
|
||||
fprintf(logFP, "***\n");
|
||||
va_end(ap);
|
||||
#if defined(XP_WIN) && defined(MOZ_DEBUG)
|
||||
// When the updater crashes on Windows the log file won't be flushed and this
|
||||
// can make it easier to debug what is going on.
|
||||
fflush(logFP);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
|
|
@ -27,6 +27,8 @@ class UpdateLog {
|
|||
|
||||
protected:
|
||||
UpdateLog();
|
||||
void PrintTimestampPrefix();
|
||||
|
||||
FILE* logFP;
|
||||
NS_tchar mDstFilePath[MAXPATHLEN];
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче