Correct logging interpolation format

This commit is contained in:
DarkCat09 2022-09-30 14:39:16 +04:00
parent 5326450e8e
commit 9ea8795bdb
4 changed files with 17 additions and 18 deletions

View file

@ -39,8 +39,6 @@ disable=raw-checker-failed,
useless-suppression, useless-suppression,
deprecated-pragma, deprecated-pragma,
use-symbolic-message-instead, use-symbolic-message-instead,
logging-not-lazy,
logging-fstring-interpolation,
no-member, no-member,
too-many-arguments, too-many-arguments,
too-many-public-methods, too-many-public-methods,
@ -134,7 +132,7 @@ redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
[LOGGING] [LOGGING]
logging-format-style=new logging-format-style=old
logging-modules=logging logging-modules=logging

View file

@ -170,7 +170,7 @@ class Client:
""" """
file = os.path.expanduser(file) file = os.path.expanduser(file)
logging.debug(f'Restoring session from {file}') logging.debug('Restoring session from %s', file)
if not os.path.exists(file): if not os.path.exists(file):
raise FileNotFoundError() raise FileNotFoundError()
@ -255,7 +255,7 @@ class Client:
""" """
file = os.path.expanduser(file) file = os.path.expanduser(file)
logging.debug(f'Saving session to {file}') logging.debug('Saving session to %s', file)
with open(file, 'wt', encoding='utf-8') as f: with open(file, 'wt', encoding='utf-8') as f:
@ -277,12 +277,12 @@ class Client:
""" """
file = os.path.expanduser(file) file = os.path.expanduser(file)
logging.debug(f'Removing session file: {file}') logging.debug('Removing session file: %s', file)
try: try:
os.remove(file) os.remove(file)
except OSError as err: except OSError as err:
logging.warning(f'Unable to delete session file: {err}') logging.warning('Unable to delete session file: %s', err)
def list_servers(self, cache: bool = True) -> List[AternosServer]: def list_servers(self, cache: bool = True) -> List[AternosServer]:
@ -313,7 +313,7 @@ class Client:
try: try:
self.save_session(self.saved_session) self.save_session(self.saved_session)
except OSError as err: except OSError as err:
logging.warning(f'Unable to save servers list to file: {err}') logging.warning('Unable to save servers list to file: %s', err)
return self.servers return self.servers
@ -333,7 +333,7 @@ class Client:
if servid == '': if servid == '':
continue continue
logging.debug(f'Adding server {servid}') logging.debug('Adding server %s', servid)
srv = AternosServer(servid, self.atconn) srv = AternosServer(servid, self.atconn)
self.servers.append(srv) self.servers.append(srv)

View file

@ -221,12 +221,12 @@ class AternosConnect:
reqcookies['ATERNOS_SESSION'] = self.atsession reqcookies['ATERNOS_SESSION'] = self.atsession
del self.session.cookies['ATERNOS_SESSION'] del self.session.cookies['ATERNOS_SESSION']
logging.debug(f'Requesting({method}){url}') logging.debug('Requesting(%s)%s', method, url)
logging.debug(f'headers={headers}') logging.debug('headers=%s', headers)
logging.debug(f'params={params}') logging.debug('params=%s', params)
logging.debug(f'data={data}') logging.debug('data=%s', data)
logging.debug(f'req-cookies={reqcookies}') logging.debug('req-cookies=%s', reqcookies)
logging.debug(f'session-cookies={self.session.cookies}') logging.debug('session-cookies=%s', self.session.cookies)
if method == 'POST': if method == 'POST':
sendreq = partial( sendreq = partial(
@ -260,9 +260,10 @@ class AternosConnect:
sendtoken, retry - 1 sendtoken, retry - 1
) )
logging.debug('AternosConnect received: ' + req.text[:65]) logging.debug('AternosConnect received: %s', req.text[:65])
logging.info( logging.info(
f'{method} completed with {req.status_code} status' '%s completed with %s status',
method, req.status_code
) )
if req.status_code == 402: if req.status_code == 402:

View file

@ -174,7 +174,7 @@ class AternosWss:
continue continue
if strm.stream: if strm.stream:
logging.debug(f'Requesting {strm.stream} stream') logging.debug('Requesting %s stream', strm.stream)
await self.send({ await self.send({
'stream': strm.stream, 'stream': strm.stream,
'type': 'start' 'type': 'start'