Added a diagnostic logger that outputs to a passed in ostream (+1 squashed commits)

Squashed commits:

[2e0a06c] Moved generic diagnostic logic to a more common location