Skip to content

Commit

Permalink
#38: improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Aug 2, 2023
1 parent 08e0a6d commit 9121839
Showing 1 changed file with 36 additions and 31 deletions.
67 changes: 36 additions & 31 deletions lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -2054,41 +2054,46 @@ class MetadataType {
*/
static getKeysForFixing(metadataMap) {
const keysForDeploy = [];

for (const item of Object.values(metadataMap)) {
if (item[this.definition.nameField].length > this.definition.maxKeyLength) {
Util.logger.warn(
`Name of the item ${
item[this.definition.keyField]
} is too long for a key. Consider renaming your item. Key will be equal first ${
if (Object.keys(metadataMap).length) {
Util.logger.info(
`Searching for ${this.definition.type} keys among downloaded items that need fixing:`
);
for (const item of Object.values(metadataMap)) {
if (item[this.definition.nameField].length > this.definition.maxKeyLength) {
Util.logger.warn(
`Name of the item ${
item[this.definition.keyField]
} is too long for a key. Consider renaming your item. Key will be equal first ${
this.definition.maxKeyLength
} characters of the name`
);
item[this.definition.nameField] = item[this.definition.nameField].slice(
0,
this.definition.maxKeyLength
} characters of the name`
);
item[this.definition.nameField] = item[this.definition.nameField].slice(
0,
this.definition.maxKeyLength
);
}
);
}

if (
item[this.definition.nameField] != item[this.definition.keyField] &&
!this.definition.keyIsFixed
) {
keysForDeploy.push(item[this.definition.keyField]);
Util.logger.info(
` - added ${this.definition.type} to fixKey queue: ${
item[this.definition.keyField]
}`
);
} else {
Util.logger.info(
Util.getGrayMsg(
` ☇ skipping ${this.definition.type} ${
if (
item[this.definition.nameField] != item[this.definition.keyField] &&
!this.definition.keyIsFixed
) {
keysForDeploy.push(item[this.definition.keyField]);
Util.logger.info(
` - added ${this.definition.type} to fixKey queue: ${
item[this.definition.keyField]
}: key does not need to be updated`
)
);
}`
);
} else {
Util.logger.info(
Util.getGrayMsg(
` ☇ skipping ${this.definition.type} ${
item[this.definition.keyField]
}: key does not need to be updated`
)
);
}
}
Util.logger.info(`Found ${keysForDeploy.length} ${this.definition.type} keys to fix`);
}
return keysForDeploy;
}
Expand Down

0 comments on commit 9121839

Please sign in to comment.