Restructure the logging engine

This also enables logging for daemon-mode.
Rework the daemon context
Merge branch 'develop'