Add 'errors' parameter to _open_log(), handle strange characters.
This commit is contained in:
parent
31dceaf37d
commit
f3a9812a27
|
@ -1,6 +1,5 @@
|
|||
import sys
|
||||
import os
|
||||
import codecs
|
||||
import time
|
||||
import socket
|
||||
import quixote
|
||||
|
@ -42,12 +41,8 @@ class DefaultLogger:
|
|||
|
||||
def _open_log(self, filename):
|
||||
charset = self.DEFAULT_CHARSET or quixote.DEFAULT_CHARSET
|
||||
if charset == 'iso-8859-1':
|
||||
return open(filename, 'ab', 1)
|
||||
else:
|
||||
return codecs.open(filename, 'ab',
|
||||
encoding=charset,
|
||||
buffering=1)
|
||||
return open(filename, 'a', encoding=charset, buffering=1,
|
||||
errors='xmlcharrefreplace')
|
||||
|
||||
def log(self, msg):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue