Major logging functionality.