Enable Write-Ahead Logging (WAL) for osod SQLite database

To ensure osod doesn't get locked out from the database by readers
(i.e. winddb), enable SQLite WAL support. This allows one writer and
any number of readers to concurrently access the database without
risk of blocking the writer.

This fixes the issue where osod sporadically crashed due to database
errors (lock-out).

WAL requires SQLite v3.7 or later.
Close database cursor upon query failure
Convert tabs to spaces
Replace home-grown log framework with Python logging