logkit: cleanup and bugfixes.
logkit: unit tests

to be backported in CXKit.