Skip to main content
This recipe transforms the usage of util.log() to use console.log() to handle Node.js DEP0059.

What It Does

This codemod replaces:
  • util.log() calls with console.log() including timestamp formatting
  • Removes unnecessary util imports when no longer needed

Before/After

Before:
After:

Multiple Log Statements

Before:
After:

Usage

Run this codemod on your project:
util.log() automatically prefixed messages with a timestamp. The codemod preserves this behavior by adding new Date().toLocaleString() as the first argument to console.log().
If you’re using a structured logging library, you may want to review the transformed code and replace console.log() with your logger’s timestamp functionality instead.