move logging configuration to a function