core: Add an overridable logging function