logger: Use pathlib.Path.open() instead of open().
This commit is contained in:
parent
cabc8fcd94
commit
19cc6229a2
1 changed files with 4 additions and 4 deletions
|
@ -120,7 +120,7 @@ class Logger(object):
|
||||||
return
|
return
|
||||||
filename = log_dir / room
|
filename = log_dir / room
|
||||||
try:
|
try:
|
||||||
fd = open(filename, 'a', encoding='utf-8')
|
fd = filename.open('a', encoding='utf-8')
|
||||||
self._fds[room] = fd
|
self._fds[room] = fd
|
||||||
return fd
|
return fd
|
||||||
except IOError:
|
except IOError:
|
||||||
|
@ -149,7 +149,7 @@ class Logger(object):
|
||||||
|
|
||||||
filename = log_dir / jid
|
filename = log_dir / jid
|
||||||
try:
|
try:
|
||||||
fd = open(filename, 'rb')
|
fd = filename.open('rb')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
log.info(
|
log.info(
|
||||||
'Non-existing log file (%s)',
|
'Non-existing log file (%s)',
|
||||||
|
@ -228,8 +228,8 @@ class Logger(object):
|
||||||
filename = log_dir / 'roster.log'
|
filename = log_dir / 'roster.log'
|
||||||
if not self._roster_logfile:
|
if not self._roster_logfile:
|
||||||
try:
|
try:
|
||||||
self._roster_logfile = open(
|
self._roster_logfile = filename.open(
|
||||||
filename, 'a', encoding='utf-8')
|
'a', encoding='utf-8')
|
||||||
except IOError:
|
except IOError:
|
||||||
log.error(
|
log.error(
|
||||||
'Unable to create the log file (%s)',
|
'Unable to create the log file (%s)',
|
||||||
|
|
Loading…
Reference in a new issue