DEP0059:util.log()
类型:运行时
¥Type: Runtime
util.log() API 已被弃用,因为它是一个未维护的旧版 API,意外暴露给用户。相反,请根据你的具体需求考虑以下替代方案:
¥The util.log() API has been deprecated because it's an unmaintained
legacy API that was exposed to user land by accident. Instead,
consider the following alternatives based on your specific needs:
- 
第三方日志库
¥Third-Party Logging Libraries
 - 
使用
console.log(new Date().toLocaleString(), message)¥Use
console.log(new Date().toLocaleString(), message) 
通过采用这些替代方案之一,你可以从 util.log() 过渡并选择符合应用的特定要求和复杂性的日志记录策略。
¥By adopting one of these alternatives, you can transition away from util.log()
and choose a logging strategy that aligns with the specific
requirements and complexity of your application.
可自动迁移 (source):
¥An automated migration is available (source):
npx codemod@latest @nodejs/util-log-to-console-log