Add logging framework

Add a logging framework with pluggable loggers.