From 810747b706963f54d5c67dffaf3e59d950e51fd9 Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Thu, 15 Jan 2026 16:23:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E8=AF=95=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=E4=B8=8D=E5=86=8D=E8=BE=93=E5=87=BA=E5=88=B0=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E5=8E=9F=E7=94=9F=E6=8E=A7=E5=88=B6=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 所有 log/warn/error 只推送到自有控制台 - 移除对原始 console 方法的调用 --- functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions.php b/functions.php index ba7eb7a..8a09d70 100644 --- a/functions.php +++ b/functions.php @@ -571,10 +571,10 @@ function argon_debug_console_script() { function addLog(type,args,source){var msg=Array.prototype.slice.call(args).map(function(a){if(typeof a==='object'){try{return JSON.stringify(a,null,2);}catch(e){return String(a);}}return String(a);}).join(' ');var hash=hashError(msg,source),time=new Date().toLocaleTimeString();logs.push({type:type,msg:msg,source:source,time:time,hash:hash});counts.all++;counts[type]=(counts[type]||0)+1;updateCounts();if(type==='error')showErrorToast(msg,hash);renderLogs();} function renderLogs(){var body=document.getElementById('argon-debug-console-body');if(!body)return;var filtered=currentFilter==='all'?logs:logs.filter(function(l){return l.type===currentFilter;});body.innerHTML=filtered.map(function(log){var muted=isMuted(log.hash);var muteBtn=isAdmin&&log.type==='error'?'':'';return '
'+muteBtn+'['+log.time+'] '+log.msg.replace(//g,'>').replace(/\n/g,'
')+(log.source?''+log.source+'':'')+'
';}).join('');body.scrollTop=body.scrollHeight;} var oc={log:console.log,warn:console.warn,error:console.error,info:console.info}; - console.log=function(){oc.log.apply(console,arguments);addLog('log',arguments);}; - console.info=function(){oc.info.apply(console,arguments);addLog('log',arguments);}; - console.warn=function(){oc.warn.apply(console,arguments);addLog('warn',arguments);}; - console.error=function(){oc.error.apply(console,arguments);addLog('error',arguments);}; + console.log=function(){addLog('log',arguments);}; + console.info=function(){addLog('log',arguments);}; + console.warn=function(){addLog('warn',arguments);}; + console.error=function(){addLog('error',arguments);}; window.addEventListener('error',function(e){var src=e.filename?e.filename.split('/').pop()+':'+e.lineno:'';addLog('error',[e.message],src);}); window.addEventListener('unhandledrejection',function(e){addLog('error',['Promise: '+(e.reason?(e.reason.message||e.reason):'Unknown')]);}); var panel=document.getElementById('argon-debug-console'),header=document.getElementById('argon-debug-console-header');