small changes for resource loading logging

This commit is contained in:
Natsumi
2023-03-25 03:57:33 +13:00
parent 3f0a479e1a
commit 4d97dcb798
5 changed files with 45 additions and 19 deletions

View File

@@ -933,7 +933,7 @@ namespace VRCX
private bool ParseLogStringDownload(FileInfo fileInfo, LogContext logContext, string line, int offset) private bool ParseLogStringDownload(FileInfo fileInfo, LogContext logContext, string line, int offset)
{ {
// 2023.03.23 11:37:21 Log - [String Download] Attempting to load String from URL 'https://pastebin.com/raw/BaW6NL2L' // 2023.03.23 11:37:21 Log - [String Download] Attempting to load String from URL 'https://pastebin.com/raw/BaW6NL2L'
string check = "] Attempting to load String from URL '"; var check = "] Attempting to load String from URL '";
if (!line.Contains(check)) if (!line.Contains(check))
return false; return false;
@@ -943,14 +943,20 @@ namespace VRCX
var stringData = line.Substring(lineOffset + check.Length); var stringData = line.Substring(lineOffset + check.Length);
stringData = stringData.Remove(stringData.Length - 1); stringData = stringData.Remove(stringData.Length - 1);
AppendLog(new[] { fileInfo.Name, ConvertLogTimeToISO8601(line), "resource-load", stringData, "string" }); AppendLog(new[]
{
fileInfo.Name,
ConvertLogTimeToISO8601(line),
"resource-load-string",
stringData
});
return true; return true;
} }
private bool ParseLogImageDownload(FileInfo fileInfo, LogContext logContext, string line, int offset) private bool ParseLogImageDownload(FileInfo fileInfo, LogContext logContext, string line, int offset)
{ {
// 2023.03.23 11:32:25 Log - [Image Download] Attempting to load image from URL 'https://i.imgur.com/lCfUMX0.jpeg' // 2023.03.23 11:32:25 Log - [Image Download] Attempting to load image from URL 'https://i.imgur.com/lCfUMX0.jpeg'
string check = "] Attempting to load image from URL '"; var check = "] Attempting to load image from URL '";
if (!line.Contains(check)) if (!line.Contains(check))
return false; return false;
@@ -960,7 +966,13 @@ namespace VRCX
var imageData = line.Substring(lineOffset + check.Length); var imageData = line.Substring(lineOffset + check.Length);
imageData = imageData.Remove(imageData.Length - 1); imageData = imageData.Remove(imageData.Length - 1);
AppendLog(new[] { fileInfo.Name, ConvertLogTimeToISO8601(line), "resource-load", imageData, "image" }); AppendLog(new[]
{
fileInfo.Name,
ConvertLogTimeToISO8601(line),
"resource-load-image",
imageData
});
return true; return true;
} }

View File

@@ -4656,6 +4656,9 @@ speechSynthesis.getVoices();
var buildTreeData = (json) => { var buildTreeData = (json) => {
var node = []; var node = [];
for (var key in json) { for (var key in json) {
if (key[0] === '$') {
continue;
}
var value = json[key]; var value = json[key];
if (Array.isArray(value) && value.length === 0) { if (Array.isArray(value) && value.length === 0) {
node.push({ node.push({
@@ -8977,6 +8980,7 @@ speechSynthesis.getVoices();
this.updateVRLastLocation(); this.updateVRLastLocation();
this.getCurrentInstanceUserList(); this.getCurrentInstanceUserList();
this.lastVideoUrl = ''; this.lastVideoUrl = '';
this.lastResourceloadUrl = '';
this.applyUserDialogLocation(); this.applyUserDialogLocation();
this.applyWorldDialogInstances(); this.applyWorldDialogInstances();
this.applyGroupDialogInstances(); this.applyGroupDialogInstances();
@@ -9209,6 +9213,7 @@ speechSynthesis.getVoices();
$app.data.lastLocationDestination = ''; $app.data.lastLocationDestination = '';
$app.data.lastLocationDestinationTime = 0; $app.data.lastLocationDestinationTime = 0;
$app.data.lastVideoUrl = ''; $app.data.lastVideoUrl = '';
$app.data.lastResourceloadUrl = '';
$app.methods.addGameLogEntry = function (gameLog, location) { $app.methods.addGameLogEntry = function (gameLog, location) {
if (this.gameLogDisabled) { if (this.gameLogDisabled) {
@@ -9378,15 +9383,22 @@ speechSynthesis.getVoices();
this.nowPlaying.offset = parseInt(timestamp, 10); this.nowPlaying.offset = parseInt(timestamp, 10);
} }
break; break;
case 'resource-load': case 'resource-load-string':
if (!this.logResourceLoad) { case 'resource-load-image':
if (
!this.logResourceLoad ||
this.lastResourceloadUrl === gameLog.resourceUrl
) {
break; break;
} }
this.lastResourceloadUrl = gameLog.resourceUrl;
var entry = { var entry = {
created_at: gameLog.dt, created_at: gameLog.dt,
type: gameLog.resourceType === 'string' ? 'StringLoad' : 'ImageLoad', type:
gameLog.type === 'resource-load-string'
? 'StringLoad'
: 'ImageLoad',
resourceUrl: gameLog.resourceUrl, resourceUrl: gameLog.resourceUrl,
resourceType: gameLog.resourceType,
location location
}; };
database.addGamelogResourceLoadToDatabase(entry); database.addGamelogResourceLoadToDatabase(entry);
@@ -13372,8 +13384,10 @@ speechSynthesis.getVoices();
AppApi.ExecuteVrOverlayFunction('updateHudTimeout', '[]'); AppApi.ExecuteVrOverlayFunction('updateHudTimeout', '[]');
} }
}; };
$app.data.logResourceLoad = configRepository.getBool('VRCX_logResourceLoad', false); $app.data.logResourceLoad = configRepository.getBool(
$app.methods.saveGameLogOptions = function() { 'VRCX_logResourceLoad'
);
$app.methods.saveGameLogOptions = function () {
configRepository.setBool('VRCX_logResourceLoad', this.logResourceLoad); configRepository.setBool('VRCX_logResourceLoad', this.logResourceLoad);
}; };
@@ -20754,6 +20768,7 @@ speechSynthesis.getVoices();
if (result || !this.isRealInstance(lastLocation)) { if (result || !this.isRealInstance(lastLocation)) {
return; return;
} }
AppApi.FocusWindow();
var entry = { var entry = {
created_at: new Date().toJSON(), created_at: new Date().toJSON(),
type: 'Event', type: 'Event',

View File

@@ -1506,6 +1506,7 @@ html
el-button(size="small" icon="el-icon-time" @click="promptPhotonLobbyTimeoutThreshold" :disabled="!openVR") {{ $t('view.settings.advanced.photon.timeout_hud.timeout_threshold') }} el-button(size="small" icon="el-icon-time" @click="promptPhotonLobbyTimeoutThreshold" :disabled="!openVR") {{ $t('view.settings.advanced.photon.timeout_hud.timeout_threshold') }}
div.options-container div.options-container
span.header {{ $t('view.settings.advanced.advanced.cache_debug.header') }} span.header {{ $t('view.settings.advanced.advanced.cache_debug.header') }}
br
span.sub-header {{ $t('view.settings.advanced.advanced.pending_offline.header') }} span.sub-header {{ $t('view.settings.advanced.advanced.pending_offline.header') }}
div.options-container-item div.options-container-item
span.name {{ $t('view.settings.advanced.advanced.pending_offline.description') }} span.name {{ $t('view.settings.advanced.advanced.pending_offline.description') }}

View File

@@ -505,9 +505,8 @@ class Database {
var row = { var row = {
rowId: dbRow[0], rowId: dbRow[0],
created_at: dbRow[1], created_at: dbRow[1],
type: dbRow[3] === 'string' ? 'StringLoad' : 'ImageLoad', type: dbRow[3],
resourceUrl: dbRow[2], resourceUrl: dbRow[2],
resourceType: dbRow[3],
location: dbRow[4] location: dbRow[4]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.unshift(row);
@@ -641,7 +640,7 @@ class Database {
{ {
'@created_at': entry.created_at, '@created_at': entry.created_at,
'@resource_url': entry.resourceUrl, '@resource_url': entry.resourceUrl,
'@resource_type': entry.resourceType, '@resource_type': entry.type,
'@location': entry.location '@location': entry.location
} }
); );
@@ -1334,18 +1333,17 @@ class Database {
var checkString = ''; var checkString = '';
var checkImage = ''; var checkImage = '';
if (!resourceload_string) { if (!resourceload_string) {
checkString = `AND resource_type != 'string'`; checkString = `AND resource_type != 'StringLoad'`;
} }
if (!resourceload_image) { if (!resourceload_image) {
checkString = `AND resource_type != 'image'`; checkString = `AND resource_type != 'ImageLoad'`;
} }
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
rowId: dbRow[0], rowId: dbRow[0],
created_at: dbRow[1], created_at: dbRow[1],
type: dbRow[3] === 'string' ? 'StringLoad' : 'ImageLoad', type: dbRow[3],
resourceUrl: dbRow[2], resourceUrl: dbRow[2],
resourceType: dbRow[3],
location: dbRow[4] location: dbRow[4]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.unshift(row);

View File

@@ -41,9 +41,9 @@ class GameLogService {
gameLog.displayName = args[1]; gameLog.displayName = args[1];
break; break;
case 'resource-load': case 'resource-load-string':
case 'resource-load-image':
gameLog.resourceUrl = args[0]; gameLog.resourceUrl = args[0];
gameLog.resourceType = args[1];
break; break;
case 'video-sync': case 'video-sync':