refactor a log, make it as a gem