tasks.py: Move log.write()s inside their methods