Skip to content

Commit bc781fd

Browse files
jingjinghahahjingjingwu
andauthored
fix: 修改 address 输出日志格式问题 (#574)
Co-authored-by: jingjingwu <jingjingwu@tencent.com>
1 parent c241c71 commit bc781fd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/core/runtime/dns.hack.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ export const dnsHack = (): void => {
8585
isCalled = true;
8686

8787
const cost = Date.now() - start;
88+
const addressStr = Array.isArray(address)
89+
? address.map((a) => `${a.address}(IPv${a.family})`).join(", ")
90+
: address;
8891
if (!err) {
89-
logger.debug(`dns lookup [${cost}ms]: ${hostname} > ${address}`);
92+
logger.debug(`dns lookup [${cost}ms]: ${hostname} > ${addressStr}`);
9093
eventBus.emit(EVENT_LIST.DNS_LOOKUP_SUCCESS, address);
9194
} else {
92-
logger.error(`dns lookup [${cost}ms]: ${hostname} > ${address},
93-
error: ${err.stack}`);
95+
logger.error(`dns lookup [${cost}ms]: ${hostname} > ${addressStr}, error: ${err.stack}`);
9496

9597
eventBus.emit(EVENT_LIST.DNS_LOOKUP_ERROR, err);
9698
}

0 commit comments

Comments
 (0)