DRY up logging module