1- import { IExecuteFunctions , INodeExecutionData } from 'n8n-workflow' ;
1+ import { IExecuteFunctions , INodeExecutionData , LoggerProxy as Logger } from 'n8n-workflow' ;
22
33type WorkflowStep = {
44 id : string ;
@@ -72,7 +72,7 @@ export async function executeCreateAgentWorkflow(
7272 baseURL : string ,
7373) : Promise < INodeExecutionData > {
7474 try {
75- console . log ( 'Starting workflow creation...' ) ;
75+ Logger . info ( 'Starting workflow creation...' ) ;
7676
7777 // Get basic workflow information
7878 const name = this . getNodeParameter ( 'name' , i ) as string ;
@@ -81,11 +81,11 @@ export async function executeCreateAgentWorkflow(
8181 const timezone = this . getNodeParameter ( 'timezone' , i ) as string ;
8282 const agentId = this . getNodeParameter ( 'agentId' , i ) as string ;
8383
84- console . log ( 'Basic parameters:' , { name, description, active, timezone, agentId } ) ;
84+ Logger . info ( 'Basic parameters:' , { name, description, active, timezone, agentId } ) ;
8585
8686 // Get step configuration
8787 const stepConfig = this . getNodeParameter ( 'stepConfiguration' , i ) as Record < string , unknown > ;
88- console . log ( 'Step configuration:' , stepConfig ) ;
88+ Logger . info ( 'Step configuration:' , stepConfig ) ;
8989
9090 // Get schedule configurations
9191 const workflowScheduleUi = this . getNodeParameter ( 'workflowScheduleUi' , i ) as Record <
@@ -97,7 +97,7 @@ export async function executeCreateAgentWorkflow(
9797 const workflowScheduleData = workflowScheduleUi ?. scheduleConfiguration || { } ;
9898 const tcpaScheduleData = tcpaScheduleUi ?. tcpaConfiguration || { } ;
9999
100- console . log ( 'Schedule configurations:' , { workflowScheduleData, tcpaScheduleData } ) ;
100+ Logger . info ( 'Schedule configurations:' , { workflowScheduleData, tcpaScheduleData } ) ;
101101
102102 // Build workflow schedule
103103 const workflowSchedule : Schedule = {
@@ -123,7 +123,7 @@ export async function executeCreateAgentWorkflow(
123123
124124 // Configure workflow schedule
125125 if ( workflowScheduleData ) {
126- console . log ( 'Configuring workflow schedule...' ) ;
126+ Logger . info ( 'Configuring workflow schedule...' ) ;
127127 const scheduleData = workflowScheduleData as Record < string , unknown > ;
128128 const {
129129 workingDays = [ ] ,
@@ -133,7 +133,7 @@ export async function executeCreateAgentWorkflow(
133133 workingMinutesEnd = 0 ,
134134 } = scheduleData ;
135135
136- console . log ( 'Working days configuration:' , { workingDays } ) ;
136+ Logger . info ( 'Working days configuration:' , { workingDays } ) ;
137137
138138 if ( Array . isArray ( workingDays ) && workingDays . length > 0 ) {
139139 for ( const day of workingDays ) {
@@ -149,15 +149,15 @@ export async function executeCreateAgentWorkflow(
149149 ] ,
150150 } ;
151151 }
152- console . log ( 'Workflow schedule configured:' , workflowSchedule ) ;
152+ Logger . info ( 'Workflow schedule configured:' , workflowSchedule ) ;
153153 } else {
154- console . log ( 'No working days configured, using default empty schedule' ) ;
154+ Logger . info ( 'No working days configured, using default empty schedule' ) ;
155155 }
156156 }
157157
158158 // Configure TCPA schedule
159159 if ( tcpaScheduleData ) {
160- console . log ( 'Configuring TCPA schedule...' ) ;
160+ Logger . info ( 'Configuring TCPA schedule...' ) ;
161161 const tcpaData = tcpaScheduleData as Record < string , unknown > ;
162162 const {
163163 tcpaDays = [ ] ,
@@ -167,7 +167,7 @@ export async function executeCreateAgentWorkflow(
167167 tcpaMinutesEnd = 0 ,
168168 } = tcpaData ;
169169
170- console . log ( 'TCPA days configuration:' , { tcpaDays } ) ;
170+ Logger . info ( 'TCPA days configuration:' , { tcpaDays } ) ;
171171
172172 if ( Array . isArray ( tcpaDays ) && tcpaDays . length > 0 ) {
173173 for ( const day of tcpaDays ) {
@@ -183,9 +183,9 @@ export async function executeCreateAgentWorkflow(
183183 ] ,
184184 } ;
185185 }
186- console . log ( 'TCPA schedule configured:' , tcpaSchedule ) ;
186+ Logger . info ( 'TCPA schedule configured:' , tcpaSchedule ) ;
187187 } else {
188- console . log ( 'No TCPA days configured, using default empty schedule' ) ;
188+ Logger . info ( 'No TCPA days configured, using default empty schedule' ) ;
189189 }
190190 }
191191
@@ -201,7 +201,7 @@ export async function executeCreateAgentWorkflow(
201201 definition : stepDefinition ,
202202 } ;
203203
204- console . log ( 'Preparing API request with workflow:' , JSON . stringify ( workflow , null , 2 ) ) ;
204+ Logger . info ( 'Preparing API request with workflow:' , { workflow } ) ;
205205
206206 try {
207207 const response = await this . helpers . httpRequestWithAuthentication . call ( this , 'featherApi' , {
@@ -215,7 +215,7 @@ export async function executeCreateAgentWorkflow(
215215 json : true ,
216216 } ) ;
217217
218- console . log ( 'Workflow created successfully:' , JSON . stringify ( response , null , 2 ) ) ;
218+ Logger . info ( 'Workflow created successfully:' , { response } ) ;
219219
220220 return {
221221 json : response ,
@@ -224,15 +224,15 @@ export async function executeCreateAgentWorkflow(
224224 } ,
225225 } ;
226226 } catch ( apiError ) {
227- console . error ( 'API request failed:' , apiError ) ;
228- console . error ( 'Request details:' , {
227+ Logger . error ( 'API request failed:' , apiError ) ;
228+ Logger . error ( 'Request details:' , {
229229 url : `${ baseURL } /api/v1/workflow` ,
230230 workflow,
231231 } ) ;
232232 throw apiError ;
233233 }
234234 } catch ( error ) {
235- console . error ( 'Error in workflow creation:' , error ) ;
235+ Logger . error ( 'Error in workflow creation:' , error ) ;
236236 throw error ;
237237 }
238238}
0 commit comments