chop-dbhi/dicom-anon

Log Flushing

Closed this issue · 2 comments

This block:

                 if log_file:
                     h.flush()
                     h.close()

should probably appear in a finally clause rather than at each return point. Also is that even needed? Seems pretty paranoid and oddly special cased for just the log_file case.

I agree on the finally close, I will update when I have a chance, feel free to submit a pull request. As for whether it is needed or not, I guess I erred on the side of caution.

This has been abstracted out into a function by @blakedewey.