functions — and the most-hallucinated bug ai ships9 / 9
arguments, defaults, and the silent wrong-order bug
Checkpoint
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Last one. Cursor wrote a function format_log that's supposed to take a
message, an optional level (default "info"), and an optional source
(default "app"), and return a string like [info] app: started.
The signature is wrong (defaults in the wrong order) and the function body is missing entirely. Fix the signature and write the one-line body that returns the formatted string.
Two calls happen at the bottom — they should print:
[info] app: started
[warn] auth: login failed
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _