Skip to content

Commit cca821c

Browse files
committed
Loggerクラスを使うように変更。
1 parent 14c2e53 commit cca821c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+634
-495
lines changed

.claude/settings.local.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@
1010
"Bash(node --version)",
1111
"Bash(node test-remove-spaces.js:*)",
1212
"Bash(npm run format:*)",
13-
"Bash(dir \"C:\\\\Windows\\\\Media\\\\*.wav\" /b)"
13+
"Bash(dir \"C:\\\\Windows\\\\Media\\\\*.wav\" /b)",
14+
"Bash(gh issue list:*)",
15+
"WebFetch(domain:github.com)",
16+
"Bash(git add:*)",
17+
"Bash(git push)",
18+
"Bash(python 99_server.py:*)",
19+
"Bash(timeout:*)",
20+
"Bash(git checkout:*)",
21+
"Bash(curl:*)",
22+
"Bash(taskkill:*)",
23+
"Bash(netstat:*)",
24+
"Bash(ls:*)"
1425
]
1526
},
1627
"hooks": {

js/ai/ComfyUI/comfyui-management.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function comfyuiConnect() {
5757
try {
5858
socket=new WebSocket(comfyUIUrls.ws+'?clientId='+comfyUIuuid);
5959
socket.addEventListener("open",(event)=>{
60-
console.log("ComfyUIへの接続に成功しました。");
60+
comfyuiLogger.info("ComfyUIへの接続に成功しました。");
6161
});
6262
socket.addEventListener("close",(event)=>{
6363
socket=null;
@@ -192,7 +192,7 @@ throw new Error("Unexpected error: No result returned from comfyui_put_queue_v2"
192192
.catch((error)=>{
193193
let help=getText("comfyUI_workflowErrorHelp");
194194
createToastError("Generation Error",[error.message,help],8000);
195-
console.error("Error:",error);
195+
comfyuiLogger.error("Error:",error);
196196
})
197197
.finally(()=>{
198198
removeSpinner(spinnerId);
@@ -231,7 +231,7 @@ const result=await response.json();
231231
// console.log("Upload successful:", result);
232232
return result;
233233
} catch (error) {
234-
console.error("Error uploading image:",error);
234+
comfyuiLogger.error("Error uploading image:",error);
235235
throw error;
236236
}
237237
}
@@ -256,7 +256,7 @@ const options=extractComboOptions(data.KSampler.input.required.sampler_name);
256256
const models=options.map((name)=>({name: name}));
257257
updateSamplerDropdown(models);
258258
} catch (error) {
259-
console.error("comfyuiFetchSampler: Fetch error",error);
259+
comfyuiLogger.error("comfyuiFetchSampler: Fetch error",error);
260260
}
261261
}
262262

@@ -267,7 +267,7 @@ const options=extractComboOptions(data.UpscaleModelLoader.input.required.model_n
267267
const models=options.map((name)=>({name: name}));
268268
updateUpscalerDropdown(models);
269269
} catch (error) {
270-
console.error("comfyuiFetchUpscaler: Fetch error",error);
270+
comfyuiLogger.error("comfyuiFetchUpscaler: Fetch error",error);
271271
}
272272
}
273273

@@ -287,7 +287,7 @@ return a.title.localeCompare(b.title);
287287

288288
updateModelDropdown(allModels);
289289
} catch (error) {
290-
console.error("comfyuiFetchModels: Fetch error",error);
290+
comfyuiLogger.error("comfyuiFetchModels: Fetch error",error);
291291
}
292292
}
293293

@@ -298,7 +298,7 @@ const options=extractComboOptions(data.DualCLIPLoader.input.required.clip_name1)
298298
const results=options.map((name)=>({n: name,p: 0}));
299299
updateTagifyDropdown("clipDropdownId",results);
300300
} catch (error) {
301-
console.error("comfyuiClipModels: Fetch error",error);
301+
comfyuiLogger.error("comfyuiClipModels: Fetch error",error);
302302
}
303303
}
304304
async function comfyuiVaeLoader() {
@@ -308,7 +308,7 @@ const options=extractComboOptions(dataUnet.VAELoader.input.required.vae_name);
308308
const results=options.map((name)=>({name: name}));
309309
updateVaeDropdown(results);
310310
} catch (error) {
311-
console.error("comfyuiVaeLoader: Fetch error",error);
311+
comfyuiLogger.error("comfyuiVaeLoader: Fetch error",error);
312312
}
313313
}
314314

@@ -324,7 +324,7 @@ const data=await response.json();
324324
// console.log("comfyuiFetchObjectInfo:", data);
325325
return data;
326326
} catch (error) {
327-
console.error("Comfyui_Fetch: Fetch error",nodeName);
327+
comfyuiLogger.error("Comfyui_Fetch: Fetch error",nodeName);
328328
}
329329
}
330330

@@ -342,7 +342,7 @@ const nodeNames=Object.keys(data);
342342
comfyObjectInfoList=nodeNames;
343343
return nodeNames;
344344
} catch (error) {
345-
console.error("comfyuiFetchObjectInfoOnly: Fetch error:",error);
345+
comfyuiLogger.error("comfyuiFetchObjectInfoOnly: Fetch error:",error);
346346
return [];
347347
}
348348
}

js/ai/ComfyUI/util/comfyui-util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
function comfyuiReplacePlaceholders(workflow,requestData,Type='T2I') {
33
const builder=createWorkflowBuilder(workflow);
44

5-
workflowlLogger.trace("requestData[seed]",requestData["seed"]);
5+
workflowLogger.trace("requestData[seed]",requestData["seed"]);
66

77
builder.updateNodesByInputName({
88
seed: requestData["seed"]=="-1"||requestData["seed"]=="0" ? Math.floor(Math.random()*50000000) : requestData["seed"],
@@ -50,7 +50,7 @@ const milliseconds=String(now.getMilliseconds()).padStart(3,'0');
5050

5151
var filename=`temp_${year}${month}${day}${hours}${minutes}${seconds}_${milliseconds}_${generateFilenameIndex}.png`;
5252
generateFilenameIndex++;
53-
console.log("filename:",filename);
53+
comfyuiLogger.debug("filename:",filename);
5454
return filename;
5555
}
5656

js/ai/ComfyUI/util/comfyui-workflow-builder.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if (value!==null&&value!==undefined&&value!=="") {
5050
validInputs[key]=value;
5151
}
5252
});
53-
workflowlLogger.trace("validInputs, " ,validInputs);
53+
workflowLogger.trace("validInputs, " ,validInputs);
5454

5555
if (Object.keys(validInputs).length>0) {
5656
Object.entries(this.workflowCopy).forEach(([id,node])=>{
@@ -61,11 +61,11 @@ const originalValue=typeof node.inputs[inputKey];
6161
const newValue=typeof validInputs[inputKey];
6262

6363
if (originalValue===newValue){
64-
workflowlLogger.trace("validInputs, replase1 " ,originalValue,newValue);
64+
workflowLogger.trace("validInputs, replase1 " ,originalValue,newValue);
6565
node.inputs[inputKey]=validInputs[inputKey];
6666

6767
}else if ((isNumericType(node.inputs[inputKey])&&isNumericType(validInputs[inputKey]))){
68-
workflowlLogger.trace("validInputs, replase2 " ,originalValue,newValue);
68+
workflowLogger.trace("validInputs, replase2 " ,originalValue,newValue);
6969
node.inputs[inputKey]=validInputs[inputKey];
7070

7171
}

js/ai/ComfyUI/v2/comfyui-object-info-repository.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ storeName: "comfyObjectInfo",
1010

1111
async saveObjectInfo(objectInfo) {
1212
if (!objectInfo||Object.keys(objectInfo).length===0) {
13-
console.error("有効なObjectInfoが指定されていません");
13+
comfyuiLogger.error("有効なObjectInfoが指定されていません");
1414
return false;
1515
}
1616

@@ -21,7 +21,7 @@ updatedAt: new Date().toISOString(),
2121
});
2222
return true;
2323
} catch (error) {
24-
console.error("ObjectInfoの保存に失敗しました:",error);
24+
comfyuiLogger.error("ObjectInfoの保存に失敗しました:",error);
2525
return false;
2626
}
2727
},
@@ -31,7 +31,7 @@ try {
3131
const result=await this.store.getItem("latestObjectInfo");
3232
return result ? result.data : null;
3333
} catch (error) {
34-
console.error("ObjectInfoの取得に失敗しました:",error);
34+
comfyuiLogger.error("ObjectInfoの取得に失敗しました:",error);
3535
return null;
3636
}
3737
},
@@ -41,7 +41,7 @@ try {
4141
const result=await this.store.getItem("latestObjectInfo");
4242
return result ? result.updatedAt : null;
4343
} catch (error) {
44-
console.error("最終更新日時の取得に失敗しました:",error);
44+
comfyuiLogger.error("最終更新日時の取得に失敗しました:",error);
4545
return null;
4646
}
4747
},

js/ai/ComfyUI/v2/comfyui-util-v2.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ return false;
5252

5353
let isOnline=false;
5454
async function comfyui_monitorConnection_v2() {
55-
console.log("comfyui_monitorConnection_v2");
55+
comfyuiLogger.debug("comfyui_monitorConnection_v2");
5656
while (true) {
5757
const currentStatus=await comfyui_apiHeartbeat_v2();
5858
if (currentStatus!==isOnline) {
@@ -143,7 +143,7 @@ workflow[nodeId].inputs[inputName]=uploadResult.name;
143143
}
144144
}
145145
} catch (error) {
146-
console.error("ファイルアップロードエラー:",error);
146+
comfyuiLogger.error("ファイルアップロードエラー:",error);
147147
}
148148
}
149149

@@ -165,15 +165,15 @@ throw new Error(`HTTPエラー! ステータス: ${response.status}`);
165165
const blob=await response.blob();
166166
return URL.createObjectURL(blob);
167167
} catch (error) {
168-
console.error("画像取得エラー:",error);
168+
comfyuiLogger.error("画像取得エラー:",error);
169169
return null;
170170
}
171171
}
172172

173173
async function comfyui_fixWorkflowTypes_v2(workflow) {
174174
const objectInfo=await objectInfoRepository.getObjectInfo();
175175
if (!objectInfo) {
176-
console.warn("ObjectInfo not available, skipping type fix");
176+
comfyuiLogger.warn("ObjectInfo not available, skipping type fix");
177177
return workflow;
178178
}
179179
const fixed=JSON.parse(JSON.stringify(workflow));
@@ -255,7 +255,7 @@ subfolder: imageDataToReceive.subfolder,
255255
type: imageDataToReceive.type,
256256
});
257257
const response=await fetch(comfyUIUrls.view+"?"+params.toString());
258-
console.log("画像データをサーバーから取得しました。",
258+
comfyuiLogger.debug("画像データをサーバーから取得しました。",
259259
imageDataToReceive.filename,
260260
imageDataToReceive.subfolder,
261261
imageDataToReceive.type,);
@@ -266,11 +266,11 @@ throw new Error(`HTTPエラー! ステータス: ${response.status}`);
266266

267267
const blob=await response.blob();
268268
const imageSrc=URL.createObjectURL(blob);
269-
console.log("画像ソース:",imageSrc);
269+
comfyuiLogger.debug("画像ソース:",imageSrc);
270270

271271
return imageSrc;
272272
} catch (error) {
273-
console.error("画像取得エラー:",error);
273+
comfyuiLogger.error("画像取得エラー:",error);
274274
return null;
275275
}
276276
}
@@ -307,10 +307,10 @@ errorMessage.traceback=Array.isArray(errorDetails.traceback)
307307
}
308308
}
309309

310-
console.log("comfyui_getErrorMessage_v2 returning:",errorMessage);
310+
comfyuiLogger.debug("comfyui_getErrorMessage_v2 returning:",errorMessage);
311311
return errorMessage;
312312
}
313-
console.log("comfyui_getErrorMessage_v2 returning null");
313+
comfyuiLogger.debug("comfyui_getErrorMessage_v2 returning null");
314314
return null;
315315
}
316316

@@ -346,14 +346,14 @@ errorMessage+=error.message;
346346
errorMessage+="check COMFYUI!";
347347
}
348348

349-
console.error("Error details:",error);
349+
comfyuiLogger.error("Error details:",error);
350350
createToastError(errorMessage);
351351
return null;
352352
}
353353
}
354354

355355
async function comfyui_get_history_v2(promptId) {
356-
console.log(
356+
comfyuiLogger.debug(
357357
"comfyui_get_history_v2関数が呼び出されました。プロンプトID:",
358358
promptId
359359
);
@@ -364,12 +364,12 @@ headers: {
364364
accept: "application/json",
365365
},
366366
});
367-
console.log("サーバーに履歴データをリクエストしました。");
367+
comfyuiLogger.debug("サーバーに履歴データをリクエストしました。");
368368
const data=await response.json();
369-
console.log("履歴データ:",data);
369+
comfyuiLogger.debug("履歴データ:",data);
370370
return data;
371371
} catch (error) {
372-
console.log("Text2Imageエラー:",error);
372+
comfyuiLogger.error("Text2Imageエラー:",error);
373373
createToastError("Text2Image Error.","check COMFYUI!");
374374
return null;
375375
}
@@ -409,11 +409,11 @@ const promptId=Object.keys(response)[0];
409409
if (promptId&&response[promptId]&&response[promptId].status) {
410410
const status=response[promptId].status;
411411
const result=status.status_str==="error";
412-
console.log("comfyui_isError_v2 return",result);
412+
comfyuiLogger.debug("comfyui_isError_v2 return",result);
413413
return result;
414414
}
415415
}
416-
console.log("comfyui_isError_v2 return false");
416+
comfyuiLogger.debug("comfyui_isError_v2 return false");
417417
return false;
418418
}
419419

js/ai/ComfyUI/v2/comfyui-workflow-editor-tab.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ return button;
117117
}
118118

119119
async saveWorkflow() {
120-
console.log("saveWorkflow() start");
120+
comfyuiLogger.debug("saveWorkflow() start");
121121
const cleanWorkflow={...this.workflow};
122122

123123
await comfyUIWorkflowRepository
@@ -129,11 +129,11 @@ cleanWorkflow,
129129
this.enabled
130130
)
131131
.then(()=>{
132-
console.log("Workflow saved successfully");
132+
comfyuiLogger.debug("Workflow saved successfully");
133133
this.clearUnsavedState();
134134
})
135135
.catch((error)=>{
136-
console.error("Workflowの保存に失敗しました:",error);
136+
comfyuiLogger.error("Workflowの保存に失敗しました:",error);
137137
});
138138
}
139139
clearUnsavedState() {
@@ -372,7 +372,7 @@ URL.revokeObjectURL(imageUrl);
372372
};
373373
}
374374
} catch (error) {
375-
console.error("画像プレビューの読み込みエラー:",error);
375+
comfyuiLogger.error("画像プレビューの読み込みエラー:",error);
376376
}
377377
}
378378
}
@@ -464,7 +464,7 @@ const previewContainer=this.contentElement.querySelector(`[data-preview-id="${pr
464464
if (previewContainer) {
465465
const previewImage=previewContainer.querySelector("img");
466466
if (previewImage) {
467-
console.log("selectedValue",selectedValue);
467+
comfyuiLogger.debug("selectedValue",selectedValue);
468468
const imageUrl=await comfyui_view_image_v2(selectedValue);
469469
if (imageUrl) {
470470
previewImage.src=imageUrl;
@@ -554,7 +554,7 @@ select.value=uploadResult.name;
554554
}
555555
}
556556
} catch (error) {
557-
console.error("アップロードエラー:",error);
557+
comfyuiLogger.error("アップロードエラー:",error);
558558
}
559559

560560
const reader=new FileReader();

0 commit comments

Comments
 (0)