Log Level Sorter¶
Run the Log Level Sorter MicroSim Fullscreen
You can include this MicroSim on your website using the following iframe:
<iframe src="https://dmccreary.github.io/robot-arm/sims/log-level-sorter/main.html"
height="627px" width="100%" scrolling="no"></iframe>
Description¶
Set the minimum log level and watch which of eight messages from an arm program stay on the console. Then sort the same eight messages into the five log levels DEBUG, INFO, WARNING, ERROR and CRITICAL. Used in Chapter 13.
The five levels are ordered by their numbers: DEBUG (10), INFO (20), WARNING (30), ERROR (40) and CRITICAL (50). A message is shown when its level is at or above the minimum level.
Lesson Plan¶
Grade level: Middle school and up (age 12+). Time: 10 to 15 minutes.
- Explore. The console starts at DEBUG, so all eight messages are shown. Raise the minimum level one step at a time. How many messages are left at INFO, at WARNING and at ERROR?
- Explain it. Python's root logger starts at WARNING. Which of these eight messages would a new program hide?
- Eight messages. Choose Eight messages in the menu. Each message is shown without its level. Press the level it should have. Pressing a button commits your answer. You get one attempt at each, and 7 of 8 is mastery.
- Think about it. Why is it a bad idea to log everything as ERROR so that nothing is missed?
A useful test for each message: is it a routine detail (DEBUG), a normal event (INFO), a surprise that the program handled (WARNING), a failed operation (ERROR), or a program that cannot go on or a safety risk (CRITICAL)?
Specification¶
The learning objective, evidence of mastery and content for this MicroSim are specified in Chapter 13: Logging, Testing, Simulation, and ROS 2.