Little refactor logging.record
Added tests