Skip to content

Commit

Permalink
[#370] Updated DisplayCAL.log.SafeLogger.__init__() to properly ini…
Browse files Browse the repository at this point in the history
…tialize the `print_` arg with `None` and set its default value inside the method, instead of writing a complex expression on the argument itself.
  • Loading branch information
eoyilmaz committed Oct 9, 2024
1 parent 40a358b commit 6387aa3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions DisplayCAL/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ def write(self, msg):


class SafeLogger(SafePrinter):
"""
Print and log safely, avoiding any UnicodeDe-/EncodingErrors on strings
"""Print and log safely, avoiding any UnicodeDe-/EncodingErrors on strings
and converting all other objects to safe string representations.
"""

def __init__(self, log=True, print_=sys.stdout and hasattr(sys.stdout, "isatty") and
sys.stdout.isatty()):
def __init__(self, log=True, print_=None):
SafePrinter.__init__(self)
self.log = log
if print_ is None:
print_ = sys.stdout and hasattr(sys.stdout, "isatty") and sys.stdout.isatty()
self.print_ = print_

def write(self, *args, **kwargs):
Expand Down

0 comments on commit 6387aa3

Please sign in to comment.