Small refactoring of couch_log Also added a precompiled end-of-line regexp to the state of the gen_event and a missing file:close/1 call.