}
void HistoryLogger::LogHistoryStart(const std::string& pkgid,
- RequestType type) {
+ const std::string& version, RequestType type) {
if (started_)
return;
HistoryBuilder builder;
- builder.Append(pkgid).Append(GetRequestTypeString(type)).Append("START");
+ builder.Append(pkgid).Append(version).Append(GetRequestTypeString(type)).
+ Append("START");
backend_->WriteLog(::utils::LogLevel::LOG_INFO, "", builder.Build());
backend_->WriteLogToFile();
}
void HistoryLogger::LogHistoryEnd(const std::string& pkgid,
- RequestType type, bool success) {
+ const std::string& version, RequestType type, bool success) {
HistoryBuilder builder;
- builder.Append(pkgid).Append(GetRequestTypeString(type));
+ builder.Append(pkgid).Append(version).Append(GetRequestTypeString(type));
if (success)
builder.Append("SUCCESS");
else
public:
HistoryLogger();
~HistoryLogger() {}
- void LogHistoryStart(const std::string& pkgid, RequestType type);
- void LogHistoryEnd(const std::string& pkgid, RequestType type, bool success);
+ void LogHistoryStart(const std::string& pkgid, const std::string& version,
+ RequestType type);
+ void LogHistoryEnd(const std::string& pkgid, const std::string& version,
+ RequestType type, bool success);
private:
class HistoryBuilder {
}
if (!context_->pkgid.get().empty())
history_logger_.LogHistoryStart(context_->pkgid.get(),
- context_->request_type.get());
+ GetPackageVersion(), context_->request_type.get());
SendProgress(current_step * kProgressRange / total_steps);
}
SendFinished(status_);
history_logger_.LogHistoryEnd(context_->pkgid.get(),
- context_->request_type.get(), false);
+ GetPackageVersion(), context_->request_type.get(), false);
return result_;
}
SendFinished(status_);
history_logger_.LogHistoryEnd(context_->pkgid.get(),
- context_->request_type.get(), true);
+ GetPackageVersion(), context_->request_type.get(), true);
return result_;
}
context_->pkgid.get());
}
+std::string AppInstaller::GetPackageVersion() {
+ std::string version;
+ if (context_->manifest_data.get()) {
+ version = context_->manifest_data.get()->version ?
+ context_->manifest_data.get()->version : "";
+ } else {
+ PkgQueryInterface pkg_query(context_->pkgid.get(), context_->uid.get());
+ version = pkg_query.Version();
+ }
+ return version;
+}
+
bool AppInstaller::SendStartIfNotSent(bool is_skippable) {
if (!pi_)
return false;
Step::Status (Step::*method)(),
std::string name);
void HandleStepError(Step::Status result, const std::string& error);
+ std::string GetPackageVersion();
std::shared_ptr<utils::FileLogBackend> failure_logger_;
Step::Status status_;