feat: http与ws共站支持热重载

This commit is contained in:
挂神
2024-07-24 13:02:37 +08:00
parent c9a1e6e748
commit 17ee49937c
4 changed files with 62 additions and 37 deletions

View File

@@ -91,8 +91,10 @@ export function enableConsoleLog(enable: boolean) {
function formatMsg(msg: any[]) {
let logMsg = '';
for (const msgItem of msg) {
// 判断是否是对象
if (typeof msgItem === 'object') {
if (msgItem instanceof Error) { // 判断是否是错误
logMsg += msgItem.stack + ' ';
continue;
} else if (typeof msgItem === 'object') { // 判断是否是对象
const obj = JSON.parse(JSON.stringify(msgItem, null, 2));
logMsg += JSON.stringify(truncateString(obj)) + ' ';
continue;