mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-12 15:27:14 +03:00
Trace: Change several calls from debug to trace.
This commit is contained in:
parent
3c0ac76f90
commit
1aba1a0596
@ -632,7 +632,7 @@ class AppWindow(object):
|
||||
while True:
|
||||
entry = monitor.get_entry()
|
||||
if not entry:
|
||||
logger.debug('No entry from monitor.get_entry()')
|
||||
logger.trace('No entry from monitor.get_entry()')
|
||||
return
|
||||
|
||||
# Update main window
|
||||
@ -684,7 +684,7 @@ class AppWindow(object):
|
||||
self.login()
|
||||
|
||||
if not entry['event'] or not monitor.mode:
|
||||
logger.debug('Startup or in CQC, returning')
|
||||
logger.trace('Startup or in CQC, returning')
|
||||
return # Startup or in CQC
|
||||
|
||||
if entry['event'] in ['StartUp', 'LoadGame'] and monitor.started:
|
||||
|
13
companion.py
13
companion.py
@ -274,7 +274,7 @@ class Auth(object):
|
||||
s = random.SystemRandom().getrandbits(8 * 32)
|
||||
self.state = self.base64_url_encode(s.to_bytes(32, byteorder='big'))
|
||||
# Won't work under IE: https://blogs.msdn.microsoft.com/ieinternals/2011/07/13/understanding-protocols/
|
||||
logger.debug(f'Trying auth from scratch for Commander "{self.cmdr}"')
|
||||
logger.info(f'Trying auth from scratch for Commander "{self.cmdr}"')
|
||||
challenge = self.base64_url_encode(hashlib.sha256(self.verifier).digest())
|
||||
webbrowser.open(
|
||||
f'{SERVER_AUTH}{URL_AUTH}?response_type=code&audience=frontier&scope=capi&client_id={CLIENT_ID}&code_challenge={challenge}&code_challenge_method=S256&state={self.state}&redirect_uri={protocolhandler.redirect}' # noqa: E501 # I cant make this any shorter
|
||||
@ -399,7 +399,7 @@ class Session(object):
|
||||
raise CredentialsError('Missing credentials') # Shouldn't happen
|
||||
|
||||
elif self.state == Session.STATE_OK:
|
||||
logger.debug('already logged in')
|
||||
logger.debug('already logged in (state == STATE_OK)')
|
||||
return True # already logged in
|
||||
|
||||
else:
|
||||
@ -409,7 +409,6 @@ class Session(object):
|
||||
return True # already logged in
|
||||
|
||||
else:
|
||||
# changed account or retrying login during auth
|
||||
logger.debug('changed account or retrying login during auth')
|
||||
self.close()
|
||||
self.credentials = credentials
|
||||
@ -461,7 +460,7 @@ class Session(object):
|
||||
|
||||
def query(self, endpoint: str) -> CAPIData:
|
||||
"""Perform a query against the specified CAPI endpoint."""
|
||||
logger.debug(f'Performing query for endpoint "{endpoint}"')
|
||||
logger.trace(f'Performing query for endpoint "{endpoint}"')
|
||||
if self.state == Session.STATE_INIT:
|
||||
if self.login():
|
||||
return self.query(endpoint)
|
||||
@ -471,7 +470,7 @@ class Session(object):
|
||||
raise CredentialsError('cannot make a query when unauthorized')
|
||||
|
||||
try:
|
||||
logger.debug('Trying...')
|
||||
logger.trace('Trying...')
|
||||
r = self.session.get(self.server + endpoint, timeout=timeout)
|
||||
|
||||
except Exception as e:
|
||||
@ -479,7 +478,7 @@ class Session(object):
|
||||
raise ServerError(f'unable to get endpoint {endpoint}') from e
|
||||
|
||||
if r.url.startswith(SERVER_AUTH):
|
||||
logger.debug('Redirected back to Auth Server')
|
||||
logger.info('Redirected back to Auth Server')
|
||||
# Redirected back to Auth server - force full re-authentication
|
||||
self.dump(r)
|
||||
self.invalidate()
|
||||
@ -521,7 +520,7 @@ class Session(object):
|
||||
|
||||
self.retrying = False
|
||||
if 'timestamp' not in data:
|
||||
logger.debug('timestamp not in data, adding from response headers')
|
||||
logger.trace('timestamp not in data, adding from response headers')
|
||||
data['timestamp'] = time.strftime('%Y-%m-%dT%H:%M:%SZ', parsedate(r.headers['Date'])) # type: ignore
|
||||
|
||||
return data
|
||||
|
10
monitor.py
10
monitor.py
@ -243,7 +243,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
for line in loghandle:
|
||||
try:
|
||||
if b'"event":"Location"' in line:
|
||||
logger.debug('"Location" event in the past at startup')
|
||||
logger.trace('"Location" event in the past at startup')
|
||||
|
||||
self.parse_entry(line) # Some events are of interest even in the past
|
||||
|
||||
@ -327,7 +327,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
loghandle.seek(log_pos, SEEK_SET) # reset EOF flag # TODO: log_pos reported as possibly unbound
|
||||
for line in loghandle:
|
||||
if b'"event":"Location"' in line:
|
||||
logger.debug('Found "Location" event, appending to event_queue')
|
||||
logger.trace('Found "Location" event, appending to event_queue')
|
||||
|
||||
self.event_queue.append(line)
|
||||
|
||||
@ -538,7 +538,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.planet = entry.get('Body') if entry.get('BodyType') == 'Planet' else None
|
||||
|
||||
if event_type == 'Location':
|
||||
logger.debug('"Location" event')
|
||||
logger.trace('"Location" event')
|
||||
|
||||
elif event_type == 'FSDJump':
|
||||
self.planet = None
|
||||
@ -827,7 +827,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
entry = self.parse_entry(self.event_queue.pop(0))
|
||||
|
||||
if entry['event'] == 'Location':
|
||||
logger.debug('"Location" event')
|
||||
logger.trace('"Location" event')
|
||||
|
||||
if not self.live and entry['event'] not in (None, 'Fileheader'):
|
||||
# Game not running locally, but Journal has been updated
|
||||
@ -856,7 +856,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
])
|
||||
|
||||
if entry['event'] == 'Location':
|
||||
logger.debug('Appending "Location" event to event_queue')
|
||||
logger.trace('Appending "Location" event to event_queue')
|
||||
|
||||
self.event_queue.append(json.dumps(entry, separators=(', ', ':')))
|
||||
|
||||
|
2
plug.py
2
plug.py
@ -304,7 +304,7 @@ def notify_journal_entry(cmdr, is_beta, system, station, entry, state):
|
||||
:returns: Error message from the first plugin that returns one (if any)
|
||||
"""
|
||||
if entry['event'] in ('Location'):
|
||||
logger.debug('Notifying plugins of "Location" event')
|
||||
logger.trace('Notifying plugins of "Location" event')
|
||||
|
||||
error = None
|
||||
for plugin in PLUGINS:
|
||||
|
@ -333,7 +333,7 @@ def journal_entry(
|
||||
) -> None:
|
||||
"""Journal Entry hook."""
|
||||
if entry['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked'):
|
||||
logger.debug(f'''{entry["event"]}
|
||||
logger.trace(f'''{entry["event"]}
|
||||
Commander: {cmdr}
|
||||
System: {system}
|
||||
Station: {station}
|
||||
@ -431,7 +431,7 @@ entry: {entry!r}'''
|
||||
this.queue.put((cmdr, materials))
|
||||
|
||||
if entry['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked'):
|
||||
logger.debug(f'''{entry["event"]}
|
||||
logger.trace(f'''{entry["event"]}
|
||||
Queueing: {entry!r}'''
|
||||
)
|
||||
this.queue.put((cmdr, entry))
|
||||
@ -530,12 +530,12 @@ def worker() -> None:
|
||||
|
||||
if should_send(pending):
|
||||
if any(p for p in pending if p['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked')):
|
||||
logger.debug("pending has at least one of "
|
||||
logger.trace("pending has at least one of "
|
||||
"('CarrierJump', 'FSDJump', 'Location', 'Docked')"
|
||||
" and it passed should_send()")
|
||||
for p in pending:
|
||||
if p['event'] in ('Location'):
|
||||
logger.debug('"Location" event in pending passed should_send(), '
|
||||
logger.trace('"Location" event in pending passed should_send(), '
|
||||
f'timestamp: {p["timestamp"]}')
|
||||
|
||||
creds = credentials(cmdr) # TODO: possibly unbound
|
||||
@ -554,13 +554,13 @@ def worker() -> None:
|
||||
if any(p for p in pending if p['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked')):
|
||||
data_elided = data.copy()
|
||||
data_elided['apiKey'] = '<elided>'
|
||||
logger.debug("pending has at least one of "
|
||||
logger.trace("pending has at least one of "
|
||||
"('CarrierJump', 'FSDJump', 'Location', 'Docked')"
|
||||
" Attempting API cal...")
|
||||
|
||||
for p in pending:
|
||||
if p['event'] in ('Location'):
|
||||
logger.debug('Attempting API call for "Location" event with timestamp: '
|
||||
logger.trace('Attempting API call for "Location" event with timestamp: '
|
||||
f'{p["timestamp"]}')
|
||||
|
||||
r = this.session.post('https://www.edsm.net/api-journal-v1', data=data, timeout=_TIMEOUT)
|
||||
|
Loading…
x
Reference in New Issue
Block a user