History

Add activity logging for uploading_asset

Ryan Huffman committed 9 years ago

Commit 88810d21 parent 014a7bc1 file · +19 −0Browse files

Showing the changes to interface/src/scripting/AssetMappingsScriptingInterface.cpp (1 of 1 file). Show all

Unified · Split

interface/src/scripting/AssetMappingsScriptingInterface.cpp+19−0
@@ -105,6 +105,25 @@ void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, · 104 unmodified lines
105105
106106 startedCallback.call();
107107
108+ QFile file { path };
109+ int64_t size { 0 };
110+ if (file.open(QIODevice::ReadOnly)) {
111+ size = file.size();
112+ file.close();
113+ }
114+
115+ QString extension = "";
116+ auto idx = path.lastIndexOf(".");
117+ if (idx) {
118+ extension = path.mid(idx + 1);
119+ }
120+
121+ UserActivityLogger::getInstance().logAction("uploading_asset", {
122+ { "size", size },
123+ { "mapping", mapping },
124+ { "extension", extension}
125+ });
126+
108127 auto upload = DependencyManager::get<AssetClient>()->createUpload(path);
109128 QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
110129 if (upload->getError() != AssetUpload::NoError) {