Additional logging. Story filtering.

* Added more logging statements
* One-a-story filtering for event types
  * This allows only one (DATE, SOURCE, TARGET, CODE) tuple per story.
* Moved some functions around.
  * The two writing functions (`pipe_output()` and `write_events()` have gone to `PETRwriter.py`