Skip to content

Commit

Permalink
Fix logging for older runtimes for runtimeapi decoration (#5988)
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Sep 23, 2024
1 parent a15d0dd commit 4729153
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions packages/api/src/base/Decorate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {

this.#runtimeLog[implName] = true;

for (let i = 0, scount = sections.length; i < scount; i++) {
if (isApiInMetadata) {
if (isApiInMetadata) {
for (let i = 0, scount = sections.length; i < scount; i++) {
const [_section, secs] = sections[i];
const sec = secs[0];
const sectionHash = blake2AsHex(_section, 64);
Expand All @@ -563,7 +563,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {

named[section][method] = objectSpread({ method, name: `${_section}_${_method}`, section, sectionHash }, def);
}
} else {
}
} else {
for (let i = 0, scount = sections.length; i < scount; i++) {
const [_section, secs] = sections[i];
const sectionHash = blake2AsHex(_section, 64);
const rtApi = apis.find(([a]) => a.eq(sectionHash));
Expand Down Expand Up @@ -594,21 +596,21 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
older.push(`${_section}/${rtApi[1].toString()} (${all.join('/')} known)`);
}
}
}

// find the runtimes that we don't have hashes for
const notFound = apis
.map(([a, v]): [HexString, string] => [a.toHex(), v.toString()])
.filter(([a]) => !hashes[a])
.map(([a, v]) => `${this._runtimeMap[a] || a}/${v}`);
// find the runtimes that we don't have hashes for
const notFound = apis
.map(([a, v]): [HexString, string] => [a.toHex(), v.toString()])
.filter(([a]) => !hashes[a])
.map(([a, v]) => `${this._runtimeMap[a] || a}/${v}`);

if (!this._options.noInitWarn && !hasLogged) {
if (older.length) {
l.warn(`${implName}: Not decorating runtime apis without matching versions: ${older.join(', ')}`);
}
if (!this._options.noInitWarn && !hasLogged) {
if (older.length) {
l.warn(`${implName}: Not decorating runtime apis without matching versions: ${older.join(', ')}`);
}

if (notFound.length) {
l.warn(`${implName}: Not decorating unknown runtime apis: ${notFound.join(', ')}`);
}
if (notFound.length) {
l.warn(`${implName}: Not decorating unknown runtime apis: ${notFound.join(', ')}`);
}
}
}
Expand Down

0 comments on commit 4729153

Please sign in to comment.