v3.30.0: Logs Indented Like Your Code πŸ“

Publication Date: 15/11/2026

Author: Anas Chakroun

Anas Chakroun

4-5 minutes

v3.29.0 made log placement more accurate. v3.30.0 is about what comes right before a log on its line: the spaces. A log at the wrong indent still runs, but it is the first thing you see when you look at your code, and unless a formatter runs on save, you fix it by hand. In code Turbo rewrites around a log, it can even leave your own lines misaligned.

v3.30.0 is an indentation release. No new features, just three situations where a log used to get the wrong spaces in JavaScript, TypeScript and PHP, each one fixed and pinned by a test.

Turbo Console Log insertion engine - v3.30.0
Logs indented like your code

How We Hunted Them

We ran Turbo on real, correctly formatted code: more than 25,000 insertions in files from projects like Next.js, Vite, TanStack Query and the Symfony demo, and in the Python standard library, each one checked automatically against the code around it.

Python passed every check: it already took its indent from the statement around the selection. JavaScript, TypeScript and PHP had three causes, below. Every one became a failing test first, and a fix second.

1. A Selection Inside a Multi-Line Statement

The log goes before the statement, so it should take the indent of the statement. It took the indent of the line you selected instead.

Selecting a prop of a multi-line JSX element

Before (v3.29.0)

function UserCard({ user, onSelect }) { console.log("πŸš€ ~ UserCard ~ user.avatar:", user.avatar) return ( <Profile name={user.name} avatar={user.avatar} onClick={() => onSelect(user.id)} /> ); }

Now (v3.30.0)

function UserCard({ user, onSelect }) { console.log("πŸš€ ~ UserCard ~ user.avatar:", user.avatar) return ( <Profile name={user.name} avatar={user.avatar} onClick={() => onSelect(user.id)} /> ); }

Selecting user.avatar put the log on the right line, before return (, but with the 6 spaces of the selected line instead of the 2 of the return. Arguments of multi-line calls, array items, returned objects, chained calls and multi-line selections did the same, and so did a value inside a chained ->where(...) call in PHP. Fix: the log takes the indent of the first line of the statement that holds the selection.

2. An Empty Block

A log that opens a block has no line to copy its indent from: the line above opens the block, the line below closes it.

Logging the error of an empty catch block

Before (v3.29.0)

export async function sendWelcomeEmail(user) { try { await mailer.send(user.email, welcomeTemplate(user)); } catch (err) { console.log("πŸš€ ~ sendWelcomeEmail ~ err:", err) } }

Now (v3.30.0)

export async function sendWelcomeEmail(user) { try { await mailer.send(user.email, welcomeTemplate(user)); } catch (err) { console.log("πŸš€ ~ sendWelcomeEmail ~ err:", err) } }

Selecting err put the log inside the catch, level with its braces. Empty functions, arrows, methods and loops written over two lines, and blocks starting with a blank line, did the same, in JavaScript, TypeScript and PHP, including PHP methods with the brace on its own line. Fix: the log copies the indent of the block's first statement, or goes one level deeper than the line that opens the block.

3. Code Turbo Rewrites Around a Log

To log a parameter of a one-line arrow, Turbo opens the arrow into a block. The new block was not always indented as one.

A multi-line body in a rewritten arrow

Your code

export function toDtos(rows) { return rows.map((row) => ({ id: row.id, name: row.name, })); }

Before (v3.29.0)

export function toDtos(rows) { return rows.map((row) => { console.log("πŸš€ ~ toDtos ~ row:", row) return { id: row.id, name: row.name, }; }); }

Now (v3.30.0)

export function toDtos(rows) { return rows.map((row) => { console.log("πŸš€ ~ toDtos ~ row:", row) return { id: row.id, name: row.name, }; }); }

Selecting row put the log at the right indent, but the returned object below it kept its old depth: return { moved one level deeper, its properties and closing brace did not. Multi-line arrays and calls returned by an arrow behaved the same. Fix: the whole returned body moves one level deeper, under the return.

A wrapped log in a rewritten arrow

Before (v3.29.0)

export function loadProfile(id) { return api.get(id).then((profile) => { console.log("πŸš€ -----------------------------------πŸš€") console.log("πŸš€ ~ loadProfile ~ profile:", profile) console.log("πŸš€ -----------------------------------πŸš€") return normalize(profile); }); }

Now (v3.30.0)

export function loadProfile(id) { return api.get(id).then((profile) => { console.log("πŸš€ -----------------------------------πŸš€") console.log("πŸš€ ~ loadProfile ~ profile:", profile) console.log("πŸš€ -----------------------------------πŸš€") return normalize(profile); }); }

With Wrap Log Message on, selecting profile indented the first wrapper line only: the log and the closing wrapper line stayed one level short. Fix: the three lines of a wrapped log share the indent of the new block.

Found the Next One?

25,000 insertions are still far fewer than the ones the Turbo community makes every month. If Turbo gives a log the wrong indent in code that is itself correctly indented, the fastest way to get it fixed is to show us the snippet.

πŸ”¬ Report an Edge Case

Paste the snippet, tell us what happened and what you expected on the Edge Cases Reporting page. Every report becomes a failing test before it becomes a fix.

Why This Is Free, and What Turbo Pro Pays For

Every fix in this release ships to every Turbo user, free, like every improvement to log insertion since 2018. That work is funded by Turbo Pro.

Turbo Pro
Turbo puts the logs in. Turbo Pro tracks them, and funds the free engine.

Turbo puts the logs in. Turbo Pro lists them all in a workspace-wide tree. You can search them instantly, filter them by log type and with git-aware filters, clean them up yourself by type and scope, and let auto-cleanup on commit remove the ones in your changed lines, always previewed first. One-time payment, lifetime access, and every future update is included.

Get Turbo Pro: pay once, keep it forever

Not a subscription. One-time purchase, lifetime access, every future update included. Every license funds the next accuracy release.