Add much more logging

This commit is contained in:
Serene-Arc
2021-03-11 13:20:39 +10:00
committed by Ali Parlakci
parent 312769cb66
commit f941161014
6 changed files with 47 additions and 21 deletions

View File

@@ -70,12 +70,12 @@ class OAuth2Authenticator:
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server.bind(('localhost', 7634))
logger.debug('Server listening on localhost:7634')
logger.log(9, 'Server listening on localhost:7634')
server.listen(1)
client = server.accept()[0]
server.close()
logger.debug('Server closed')
logger.log(9, 'Server closed')
return client
@@ -95,7 +95,7 @@ class OAuth2TokenManager(praw.reddit.BaseTokenManager):
if authorizer.refresh_token is None:
if self.config.has_option('DEFAULT', 'user_token'):
authorizer.refresh_token = self.config.get('DEFAULT', 'user_token')
logger.debug('Loaded OAuth2 token for authoriser')
logger.log(9, 'Loaded OAuth2 token for authoriser')
else:
raise RedditAuthenticationError('No auth token loaded in configuration')
@@ -103,4 +103,4 @@ class OAuth2TokenManager(praw.reddit.BaseTokenManager):
self.config.set('DEFAULT', 'user_token', authorizer.refresh_token)
with open(self.config_location, 'w') as file:
self.config.write(file, True)
logger.debug(f'Written OAuth2 token from authoriser to {self.config_location}')
logger.log(9, f'Written OAuth2 token from authoriser to {self.config_location}')