Added support for logging

Support for logging is based on Marek's work for KAFO