Skip to content

Commit

Permalink
Use human readable time when logging progress
Browse files Browse the repository at this point in the history
Summary:
Intead of using the time counter, which we then supplement with a full date/time when we open a file, just make progress logger use a human readable date/time...
While we're at it, let's print the "easy" path, which doesn't reveal gaia paths, which was the motivation for not printing the file's path originaly.
So obvious.

Reviewed By: kiminoue7

Differential Revision: D52435453

fbshipit-source-id: 5304cce1267ad1ac5f24ad887db3d60dd3347cad
  • Loading branch information
Georges Berenger authored and facebook-github-bot committed Dec 28, 2023
1 parent 9ebdc29 commit f1cde52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 3 additions & 2 deletions vrs/ProgressLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#define DEFAULT_LOG_CHANNEL "ProgressLogger"
#include <logging/Log.h>
#include <vrs/helpers/Strings.h>
#include <vrs/os/Time.h>

using namespace std;
Expand Down Expand Up @@ -103,11 +104,11 @@ void ProgressLogger::updateNextProgressTime() {
}

void ProgressLogger::logMessage(const string& message) {
XR_LOGI("{:.3f}: {}", os::getTimestampSec(), message);
XR_LOGI("{}: {}", helpers::humanReadableDateTime(os::getCurrentTimeSecSinceEpoch()), message);
}

void ProgressLogger::logError(const string& message) {
XR_LOGE("{:.3f}: {}", os::getTimestampSec(), message);
XR_LOGE("{}: {}", helpers::humanReadableDateTime(os::getCurrentTimeSecSinceEpoch()), message);
}

void ProgressLogger::updateStep(size_t /*progress*/, size_t /*maxProgress*/) {}
Expand Down
5 changes: 1 addition & 4 deletions vrs/RecordFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,7 @@ int RecordFileReader::doOpenFile(
const int kOpenTotalStepCount = 5;
openProgressLogger_->setStepCount(kOpenTotalStepCount);
LOG_PROGRESS(FileHandlerFactory::getInstance().delegateOpen(fileSpec, file_), error, [&]() {
const string& fileHandlerName =
fileSpec.fileHandlerName.empty() ? file_->getFileHandlerName() : fileSpec.fileHandlerName;
return "Opening " + fileHandlerName + " file " +
helpers::humanReadableDateTime(os::getCurrentTimeSecSinceEpoch());
return "Opening " + fileSpec.getEasyPath();
});
// log remote file handler names with success/failure status
if (file_ && file_->isRemoteFileSystem()) {
Expand Down

0 comments on commit f1cde52

Please sign in to comment.