extract logging functionality to a base class

Change-Id: Id4321f66d58fd297f5d7d0e7593be3001bd1e2b1