Enable logging optionally