Recall & Review
beginner
What is the purpose of log levels in Express applications?
Log levels help organize and filter log messages by their importance or severity, making it easier to monitor and debug applications.
Click to reveal answer
beginner
Name the common log levels used in Express logging.
Common log levels include: error, warn, info, verbose, debug, and silly.
Click to reveal answer
beginner
When should you use the 'error' log level?
Use 'error' to log serious problems that cause parts of the app to fail, like exceptions or failed database connections.
Click to reveal answer
beginner
What kind of information is suitable for the 'info' log level?
'Info' logs general events like server start, user logins, or successful operations to track normal app behavior.
Click to reveal answer
intermediate
Why use 'debug' or 'verbose' log levels during development?
'Debug' and 'verbose' provide detailed insights into app flow and variable states, helping developers find issues before release.
Click to reveal answer
Which log level should you use to record a failed database connection in Express?
✗ Incorrect
A failed database connection is a serious problem, so it should be logged as an 'error'.
What log level is best for recording a user successfully logging in?
✗ Incorrect
User logins are normal events, so 'info' is the appropriate log level.
Which log level provides the most detailed information for troubleshooting during development?
✗ Incorrect
'Debug' logs give detailed information useful for troubleshooting.
If you want to log a minor issue that does not stop the app but might need attention, which level fits best?
✗ Incorrect
'Warn' is used for potential problems that don't stop the app but should be noticed.
Which log level is least likely to be enabled in a production Express app due to verbosity?
✗ Incorrect
'Debug' logs are very detailed and usually disabled in production to reduce noise.
Explain the different log levels in Express and give an example of when to use each.
Think about how serious or detailed the message is.
You got /5 concepts.
Why is it important to choose the right log level when building an Express app?
Consider how logs help you understand your app.
You got /4 concepts.