A very efficient and small implementation of LogHandler.

The code is good, but needs a bit of cleaning.