fix(npm): Replace console logging with structured Smartlog in NPM registry and silence RubyGems helper error logging
This commit is contained in:
@@ -113,7 +113,7 @@ export class NpmRegistry extends BaseRegistry {
|
||||
const unpublishVersionMatch = path.match(/^\/(@?[^\/]+(?:\/[^\/]+)?)\/-\/([^\/]+)$/);
|
||||
if (unpublishVersionMatch && context.method === 'DELETE') {
|
||||
const [, packageName, version] = unpublishVersionMatch;
|
||||
console.log(`[unpublishVersionMatch] packageName=${packageName}, version=${version}`);
|
||||
this.logger.log('debug', 'unpublishVersionMatch', { packageName, version });
|
||||
return this.unpublishVersion(packageName, version, token);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ export class NpmRegistry extends BaseRegistry {
|
||||
const unpublishPackageMatch = path.match(/^\/(@?[^\/]+(?:\/[^\/]+)?)\/-rev\/([^\/]+)$/);
|
||||
if (unpublishPackageMatch && context.method === 'DELETE') {
|
||||
const [, packageName, rev] = unpublishPackageMatch;
|
||||
console.log(`[unpublishPackageMatch] packageName=${packageName}, rev=${rev}`);
|
||||
this.logger.log('debug', 'unpublishPackageMatch', { packageName, rev });
|
||||
return this.unpublishPackage(packageName, token);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ export class NpmRegistry extends BaseRegistry {
|
||||
const versionMatch = path.match(/^\/(@?[^\/]+(?:\/[^\/]+)?)\/([^\/]+)$/);
|
||||
if (versionMatch) {
|
||||
const [, packageName, version] = versionMatch;
|
||||
console.log(`[versionMatch] matched! packageName=${packageName}, version=${version}`);
|
||||
this.logger.log('debug', 'versionMatch', { packageName, version });
|
||||
return this.handlePackageVersion(packageName, version, token);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ export class NpmRegistry extends BaseRegistry {
|
||||
const packageMatch = path.match(/^\/(@?[^\/]+(?:\/[^\/]+)?)$/);
|
||||
if (packageMatch) {
|
||||
const packageName = packageMatch[1];
|
||||
console.log(`[packageMatch] matched! packageName=${packageName}`);
|
||||
this.logger.log('debug', 'packageMatch', { packageName });
|
||||
return this.handlePackage(context.method, packageName, context.body, context.query, token);
|
||||
}
|
||||
|
||||
@@ -254,11 +254,11 @@ export class NpmRegistry extends BaseRegistry {
|
||||
version: string,
|
||||
token: IAuthToken | null
|
||||
): Promise<IResponse> {
|
||||
console.log(`[handlePackageVersion] packageName=${packageName}, version=${version}`);
|
||||
this.logger.log('debug', 'handlePackageVersion', { packageName, version });
|
||||
const packument = await this.storage.getNpmPackument(packageName);
|
||||
console.log(`[handlePackageVersion] packument found:`, !!packument);
|
||||
this.logger.log('debug', 'handlePackageVersion packument', { found: !!packument });
|
||||
if (packument) {
|
||||
console.log(`[handlePackageVersion] versions:`, Object.keys(packument.versions || {}));
|
||||
this.logger.log('debug', 'handlePackageVersion versions', { versions: Object.keys(packument.versions || {}) });
|
||||
}
|
||||
if (!packument) {
|
||||
return {
|
||||
@@ -621,7 +621,7 @@ export class NpmRegistry extends BaseRegistry {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[handleSearch] Error:', error);
|
||||
this.logger.log('error', 'handleSearch failed', { error: (error as Error).message });
|
||||
}
|
||||
|
||||
// Apply pagination
|
||||
|
||||
Reference in New Issue
Block a user