Skip to content

Log lines that narrate each step ("Starting...", "Successfully saved") ​

Comments and text: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as narration (three or more in a file).

What makes log lines that narrate each step a bad practice? ​

The standard that calls it a bad practice: Raymond, The Art of Unix Programming, Rule of Silence: "When a program has nothing surprising to say, it should say nothing".

What does lessloc do about log lines that narrate each step? ​

lessloc catches it as narration (three or more in a file).

  • narration (tier 3): Comments that narrate the code, decorate it or restate a name, closing-brace comments, and log lines that narrate each step.

Examples ​

Caught as narration:

js
export async function sync(db) {
  console.log("Starting sync...");
  const rows = await db.all();
  console.log("Fetched rows");
  await db.save(rows);
  console.log("Successfully saved");
}

Written well:

js
export async function sync(db) {
  const rows = await db.all();
  await db.save(rows);
  console.log(`synced ${rows.length} rows`);
}

The other patterns in Comments and text:

Released under the Apache-2.0 license. · llms.txt