diff --git a/src/cdk/v2/destinations/gladly/procWorkflow.yaml b/src/cdk/v2/destinations/gladly/procWorkflow.yaml index a53a0ca8f5..dcefc9d774 100644 --- a/src/cdk/v2/destinations/gladly/procWorkflow.yaml +++ b/src/cdk/v2/destinations/gladly/procWorkflow.yaml @@ -61,7 +61,8 @@ steps: headers: $.getHeaders(.destination) } const endpoint = $.getEndpoint(.destination) + "?" + $.getQueryParams($.context.payload); - const rawResponse = await $.httpGET(endpoint,requestOptions) + const reqStats = {metadata:.metadata, module: 'router',feature: "transformation", destType:"gladly",requestMethod:"get",endpointPath:"/api/v1/customer-profiles"} + const rawResponse = await $.httpGET(endpoint,requestOptions, reqStats) const processedResponse = $.processAxiosResponse(rawResponse) processedResponse diff --git a/src/logger.js b/src/logger.js index 6cec795498..6daff56c67 100644 --- a/src/logger.js +++ b/src/logger.js @@ -58,17 +58,33 @@ const getLogMetadata = (metadata) => { }; }; +const formLogArgs = (args) => { + let msg = ''; + let otherArgs = []; + args.forEach((arg) => { + if (typeof arg !== 'object') { + msg += ' ' + arg; + return; + } + otherArgs.push(arg); + }); + return [msg, ...otherArgs]; +}; + /** * Perform logging operation on logMethod passed * + * **Good practices**: + * - Do not have more than one array args in logger * @param {*} logMethod * - instance method reference * - The logger should implement all of debug/info/warn/error methods - * @param {*} args + * @param {*} logArgs * - the arguments that needs to be passed to logger instance method */ -const log = (logMethod, args) => { - const [message, logInfo, ...otherArgs] = args; +const log = (logMethod, logArgs) => { + const [message, ...args] = formLogArgs(logArgs); + const [logInfo, ...otherArgs] = args; if (logInfo) { const { metadata, ...otherLogInfoArgs } = logInfo; if (Array.isArray(metadata)) {