My favorite use-case for AI is writing logs

AI for logging and boilerplate

  • Many commenters like using AI for tedious, low-level tasks: log lines, docstrings, CLI glue, and repetitive boilerplate.
  • They see value in “sketch the logic, let AI add the polish,” especially across many languages/projects where logging patterns differ.
  • Others argue that if logging is truly that mechanical, macros, snippets, or AOP-like approaches should handle it deterministically instead of LLMs.

Cognitive load, tooling, and determinism

  • One camp emphasizes that reducing cognitive overhead (remembering exact logger APIs, formatting, project-specific conventions) meaningfully improves focus and flow.
  • The opposing camp argues this is what editors, LSPs, snippets, and static tools are for; an LLM is an overkill “fuzzy hammer” where deterministic autocomplete and templates are more reliable and energy-efficient.
  • There’s tension between favoring highly predictable tools vs accepting probabilistic assistance that must be verified.

Programming as craft vs problem-solving

  • Some see complaining about logging syntax as disliking “real programming” and basic competence. They take pride in carefully hand-written, context-rich logs.
  • Others separate “liking programming” from liking its minutiae: they’d rather focus on solving business problems than on remembering logging variants, and view AI as another abstraction layer like garbage collection or sort routines.
  • Broader discussion touches on career motivations: many developers are in it for pay and outcomes, not love of the craft; AI shifts value from “knowing how” toward “knowing what you want.”

Logging best practices and pitfalls

  • Multiple comments critique the use of Python f-strings in logs:
    • They eagerly format even when the log level filters them out, harming performance in hot paths.
    • They break aggregation in tools like Sentry that rely on static format strings.
  • Suggested alternative: classic parameterized logging ("msg %s", var) or libraries that support lazy {} formatting.
  • Some highlight log level discipline (avoiding noisy or misleading error logs) and warn against logging secrets such as Redis URLs.

Libraries, models, and reliability concerns

  • JetBrains’ local models and Cursor-style completions are praised as helpful, but also noted for occasionally plausible-yet-wrong suggestions.
  • Debate over loguru: some like its ergonomics and features; others dislike its nonstandard formatting syntax and backtrace style.
  • Several caution that AI-written logs and code must still be reviewed; unreliable or misleading logs can severely complicate debugging.