log refact with options.debug