How about we only do the logging if we actually have a valid FILE*

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>