Project 6 of 20, for Neil
Log Analyser
Count the errors in the flight log every system on Neil's drone writes to, and survive the lines that make no sense.
Sign up free to open itLog in
Act 2 needs a free account, so your work is saved as you go. Act 1 is open to everyone.
The brief
- NeilEverything on my drone writes to the one flight log, the GPS, the motors, the battery, the camera and the radio.
- NeilI wrote the script that reads it back in my first year, and it stops at the first bad line.
- NeilSunday's flight has got a lot of bad lines, and the drone ended up coming down in a hedge.
- PaulHave a proper read of it before you change anything, because old code usually has its reasons.
Neil's script reads flight.log and counts the errors from each system on the drone. It stops dead at the first line it can't read.
Change it so it reads every line it can, skips the ones it can't, and says which it skipped and why. Blank lines aren't problems, and a level in lower case still counts.
11 entries read Errors by system: camera: 2 gps: 2 motors: 1 Skipped 3 lines: line 6: expected 4 parts, got 3 line 9: unknown level WARNING line 12: expected 4 parts, got 1
What you learn
What's in it
- Stopping on purpose
- The wrong shape
- Read it before you touch it
- Catching it, and keeping the message
- Catching it
- Whatever happens
- Else, and finally
- Expect the odd line
- Tidied, then checked
- How Paul would do it
- Fix Caitlin's version
- Teach it some manners
- Ship it