From 241b9dbd37ebafb3183debe3da07217fe80108e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 8 Nov 2024 23:10:51 +0100 Subject: [PATCH] #1807: gray out warnings if the event/journey is not published --- lib/metadataTypes/Event.js | 12 +++++------- lib/metadataTypes/Journey.js | 17 ++++++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index 8edc02c17..27fa18d17 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -492,7 +492,7 @@ class Event extends MetadataType { delete metadata.arguments?.automationId; } } catch (ex) { - Util.logger.verbose( + Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] }): ${ex.message}.` @@ -545,9 +545,8 @@ class Event extends MetadataType { metadata.publishedInteractionCount >= 1 ); } catch (ex) { - Util.logger.warn( - ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${metadata[this.definition.keyField]}) with ${metadata.publishedInteractionCount} active journeys: ${ex.message}` - ); + const msg = ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${metadata[this.definition.keyField]}) with ${metadata.publishedInteractionCount} active journeys: ${ex.message}`; + Util.logger.warn(metadata.publishedInteractionCount === 0 ? Util.getGrayMsg(msg) : msg); } try { await this.compareSalesforceEntryEvents_dataExtension( @@ -556,9 +555,8 @@ class Event extends MetadataType { metadata.r__dataExtension_key ); } catch (ex) { - Util.logger.warn( - ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${metadata[this.definition.keyField]}) with ${metadata.publishedInteractionCount} active journeys: ${ex.message}` - ); + const msg = ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${metadata[this.definition.keyField]}) with ${metadata.publishedInteractionCount} active journeys: ${ex.message}`; + Util.logger.warn(metadata.publishedInteractionCount === 0 ? Util.getGrayMsg(msg) : msg); } return metadata; diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index affd9a83a..0d937b363 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -406,10 +406,11 @@ class Journey extends MetadataType { delete config.eventDefinitionKey; delete config.eventDefinitionId; } catch (ex) { + const msg = ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ + metadata[this.definition.keyField] + }) ${metadata.status}: ${ex.message}.`; Util.logger.warn( - ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ - metadata[this.definition.keyField] - }): ${ex.message}.` + metadata.status === 'Published' ? msg : Util.getGrayMsg(msg) ); } } @@ -440,8 +441,9 @@ class Journey extends MetadataType { this.definition.type ); } catch (ex) { + const msg = ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${metadata[this.definition.keyField]}) ${metadata.status}: ${ex.message}`; Util.logger.warn( - ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${metadata[this.definition.keyField]}): ${ex.message}` + metadata.status === 'Published' ? msg : Util.getGrayMsg(msg) ); } } @@ -1034,10 +1036,11 @@ class Journey extends MetadataType { ); delete triggeredSend.emailId; } catch { + const msg = ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ + metadata[this.definition.keyField] + }): Could not find email with ID ${triggeredSend.emailId} in Classic nor in Content Builder.`; Util.logger.warn( - ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ - metadata[this.definition.keyField] - }): Could not find email with ID ${triggeredSend.emailId} in Classic nor in Content Builder.` + metadata.status === 'Published' ? msg : Util.getGrayMsg(msg) ); } }