Add logging macros, update copyright and cleanup the headers.
mmap target file instead of reading into buffer, add missing logging.h include from previous commit.
Fix bugs, clean up and update code, a better version :P