Promptles
Debugging & Error Handling

Logging

beginner

Definition

Recording what a program does as it runs: which functions were called, what data was received, what decisions were made. Logs are like a flight recorder: when something goes wrong, you read the logs to see what happened leading up to the crash.

In the wild

console.log('User logged in:', userId); writes a message every time someone logs in. If a user reports they can't access their dashboard, you can check the logs to see if their login even succeeded.

More from Debugging & Error Handling