Skip to content

Commit

Permalink
Log: convert entry with asUTF8Bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
stump committed Dec 31, 2012
1 parent a4134e6 commit 016f375
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Log.py
Expand Up @@ -32,6 +32,7 @@
import traceback
import time
import warnings
from Unicode import asUTF8Bytes

# Whether to output log entries to stdout in addition to the logfile.
quiet = True
Expand All @@ -50,9 +51,6 @@
else:
logFile = open(Version.PROGRAM_UNIXSTYLE_NAME + ".log", "w") #MFH - local logfile!

# Character encoding to use for logging.
encoding = "iso-8859-1"

if "-v" in sys.argv or "--verbose" in sys.argv:
quiet = False

Expand Down Expand Up @@ -81,9 +79,7 @@ def _log(cls, msg):
@param cls: Priority class for the message
@param msg: Log message text
'''
if not isinstance(msg, unicode):
msg = unicode(msg, encoding)
msg = msg.encode(encoding, "replace") # fculpo - proper encoding
msg = asUTF8Bytes(msg)
timeprefix = "[%12.6f] " % (time.time() - _initTime)
if not quiet:
print timeprefix + displaylabels[cls] + " " + msg
Expand Down

0 comments on commit 016f375

Please sign in to comment.