And more logging to test

This commit is contained in:
defnotken
2025-10-12 18:47:01 -05:00
parent dae8127ac8
commit 012e80219e
3 changed files with 18 additions and 2 deletions

View File

@@ -150,7 +150,7 @@ public sealed class CacheMonitor : DisposableMediatorSubscriberBase
private void LightlessWatcher_FileChanged(object sender, FileSystemEventArgs e) private void LightlessWatcher_FileChanged(object sender, FileSystemEventArgs e)
{ {
Logger.LogTrace("Lightless FSW: FileChanged: {change} => {path}", e.ChangeType, e.FullPath); Logger.LogInformation("Lightless FSW: FileChanged: {change} => {path}", e.ChangeType, e.FullPath);
if (!AllowedFileExtensions.Any(ext => e.FullPath.EndsWith(ext, StringComparison.OrdinalIgnoreCase))) return; if (!AllowedFileExtensions.Any(ext => e.FullPath.EndsWith(ext, StringComparison.OrdinalIgnoreCase))) return;
@@ -350,6 +350,7 @@ public sealed class CacheMonitor : DisposableMediatorSubscriberBase
public void InvokeScan() public void InvokeScan()
{ {
Logger.LogInformation("InvokeScan called");
TotalFiles = 0; TotalFiles = 0;
_currentFileProgress = 0; _currentFileProgress = 0;
_scanCancellationTokenSource = _scanCancellationTokenSource?.CancelRecreate() ?? new CancellationTokenSource(); _scanCancellationTokenSource = _scanCancellationTokenSource?.CancelRecreate() ?? new CancellationTokenSource();
@@ -388,6 +389,7 @@ public sealed class CacheMonitor : DisposableMediatorSubscriberBase
TotalFiles = 0; TotalFiles = 0;
_currentFileProgress = 0; _currentFileProgress = 0;
}, token); }, token);
Logger.LogInformation("InvokeScan finished");
} }
public void RecalculateFileCacheSize(CancellationToken token) public void RecalculateFileCacheSize(CancellationToken token)

View File

@@ -152,6 +152,7 @@ public sealed class FileCacheManager : IHostedService
_logger.LogTrace("Creating cache entry for {path}", path); _logger.LogTrace("Creating cache entry for {path}", path);
var cacheFolder = _configService.Current.CacheFolder; var cacheFolder = _configService.Current.CacheFolder;
if (string.IsNullOrEmpty(cacheFolder)) return null; if (string.IsNullOrEmpty(cacheFolder)) return null;
_logger.LogInformation("CreateCacheEntry finished for {path}", path);
return CreateFileEntity(cacheFolder, CachePrefix, fi); return CreateFileEntity(cacheFolder, CachePrefix, fi);
} }
@@ -309,6 +310,8 @@ public sealed class FileCacheManager : IHostedService
public Dictionary<string, FileCacheEntity?> GetFileCachesByPaths(string[] paths) public Dictionary<string, FileCacheEntity?> GetFileCachesByPaths(string[] paths)
{ {
_logger.LogInformation("GetFileCachesByPaths called for {count} paths", paths.Length);
_getCachesByPathsSemaphore.Wait(); _getCachesByPathsSemaphore.Wait();
try try
@@ -365,6 +368,8 @@ public sealed class FileCacheManager : IHostedService
} }
finally finally
{ {
_logger.LogInformation("GetFileCachesByPaths finished for {count} paths", paths.Length);
_getCachesByPathsSemaphore.Release(); _getCachesByPathsSemaphore.Release();
} }
} }

View File

@@ -201,6 +201,9 @@ public unsafe class NameplateHandler : IMediatorSubscriber
private void UpdateNameplateNodes() private void UpdateNameplateNodes()
{ {
var framework = Framework.Instance(); var framework = Framework.Instance();
if (framework == null) return;
var ui3DModule = framework->GetUIModule()->GetUI3DModule(); var ui3DModule = framework->GetUIModule()->GetUI3DModule();
if (ui3DModule == null) if (ui3DModule == null)
@@ -208,7 +211,13 @@ public unsafe class NameplateHandler : IMediatorSubscriber
for (int i = 0; i < ui3DModule->NamePlateObjectInfoCount; ++i) for (int i = 0; i < ui3DModule->NamePlateObjectInfoCount; ++i)
{ {
var objectInfo = ui3DModule->NamePlateObjectInfoPointers[i].Value; if (ui3DModule->NamePlateObjectInfoPointers.IsEmpty) continue;
var objectInfoPtr = ui3DModule->NamePlateObjectInfoPointers[i];
if (objectInfoPtr == null) continue;
var objectInfo = objectInfoPtr.Value;
if (objectInfo == null || objectInfo->GameObject == null) if (objectInfo == null || objectInfo->GameObject == null)
continue; continue;