Optimize to_file init

Two optimisations for initialisation when `to_file` is set:
- cleaner init of the default value for `log_file`
- simpler format callback when `file_format` is not set. This improves logging speed.