New log mechanism: basic timestamp logging in place.

Mostly based on old implementation, but will now attempt to make it more
bullet proof.