Use prefixedConsole for VFS logging

Lazily initialized to avoid console-stamp issues in test environment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Isenhower 2026-02-22 10:11:40 -08:00
parent 941a6eb258
commit 96725eecbb

View File

@ -1,4 +1,5 @@
import { S3Client, ListObjectsV2Command } from '@aws-sdk/client-s3';
import prefixedConsole from './prefixedConsole.mjs';
const prefixes = ['assets/splatnet/', 'data/'];
@ -8,6 +9,10 @@ class VirtualFileSystem {
_loadPromise = null;
_localPrefix = 'dist';
get _console() {
return this.__console ??= prefixedConsole('VFS');
}
get _canUseS3() {
return !!(
process.env.AWS_ACCESS_KEY_ID &&
@ -42,7 +47,7 @@ class VirtualFileSystem {
async _loadFromS3() {
const bucket = process.env.AWS_S3_BUCKET;
console.log('[VFS] Loading S3 listing...');
this._console.info('Loading S3 listing...');
for (const prefix of prefixes) {
let continuationToken;
@ -68,7 +73,7 @@ class VirtualFileSystem {
: undefined;
} while (continuationToken);
console.log(`[VFS] Loaded ${count} entries for prefix "${prefix}"`);
this._console.info(`Loaded ${count} entries for prefix "${prefix}"`);
}
}