logger function generator