mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 00:07:14 +03:00
Quieten various TRACE log output.
* A lot of this is commented out. It might be useful in the future, but is just too noisy for now. * Changed the protocol webserver to info, as it is. * Left the EDSM 'not 1XX, 2XX or 5XX' in as it's a warning, so 'pass's on the conditional bodies that would be empty now trace's are commented.
This commit is contained in:
parent
33f0064dab
commit
bc6557dd9c
@ -535,7 +535,7 @@ class Session(object):
|
||||
|
||||
self.retrying = False
|
||||
if 'timestamp' not in data:
|
||||
logger.trace('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
|
||||
|
4
plug.py
4
plug.py
@ -258,8 +258,8 @@ def notify_journal_entry(cmdr, is_beta, system, station, entry, state):
|
||||
:param is_beta: whether the player is in a Beta universe.
|
||||
:returns: Error message from the first plugin that returns one (if any)
|
||||
"""
|
||||
if entry['event'] in ('Location'):
|
||||
logger.trace('Notifying plugins of "Location" event')
|
||||
# if entry['event'] in ('Location'):
|
||||
# logger.trace('Notifying plugins of "Location" event')
|
||||
|
||||
error = None
|
||||
for plugin in PLUGINS:
|
||||
|
@ -351,14 +351,14 @@ def journal_entry(
|
||||
return
|
||||
|
||||
this.on_foot = state['OnFoot']
|
||||
if entry['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked'):
|
||||
logger.trace(f'''{entry["event"]}
|
||||
Commander: {cmdr}
|
||||
System: {system}
|
||||
Station: {station}
|
||||
state: {state!r}
|
||||
entry: {entry!r}'''
|
||||
)
|
||||
# if entry['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked'):
|
||||
# logger.trace(f'''{entry["event"]}
|
||||
# Commander: {cmdr}
|
||||
# System: {system}
|
||||
# Station: {station}
|
||||
# state: {state!r}
|
||||
# entry: {entry!r}'''
|
||||
# )
|
||||
# Always update our system address even if we're not currently the provider for system or station, but dont update
|
||||
# on events that contain "future" data, such as FSDTarget
|
||||
if entry['event'] in ('Location', 'Docked', 'CarrierJump', 'FSDJump'):
|
||||
@ -453,10 +453,10 @@ entry: {entry!r}'''
|
||||
materials.update(transient)
|
||||
this.queue.put((cmdr, materials))
|
||||
|
||||
if entry['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked'):
|
||||
logger.trace(f'''{entry["event"]}
|
||||
Queueing: {entry!r}'''
|
||||
)
|
||||
# if entry['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked'):
|
||||
# logger.trace(f'''{entry["event"]}
|
||||
# Queueing: {entry!r}'''
|
||||
# )
|
||||
this.queue.put((cmdr, entry))
|
||||
|
||||
|
||||
@ -561,14 +561,14 @@ def worker() -> None:
|
||||
pending = list(filter(lambda x: x['event'] not in this.discardedEvents, pending))
|
||||
|
||||
if should_send(pending):
|
||||
if any(p for p in pending if p['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked')):
|
||||
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.trace('"Location" event in pending passed should_send(), '
|
||||
f'timestamp: {p["timestamp"]}')
|
||||
# if any(p for p in pending if p['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked')):
|
||||
# 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.trace('"Location" event in pending passed should_send(), '
|
||||
# f'timestamp: {p["timestamp"]}')
|
||||
|
||||
creds = credentials(cmdr) # TODO: possibly unbound
|
||||
if creds is None:
|
||||
@ -583,25 +583,25 @@ def worker() -> None:
|
||||
'message': json.dumps(pending, ensure_ascii=False).encode('utf-8'),
|
||||
}
|
||||
|
||||
if any(p for p in pending if p['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked')):
|
||||
data_elided = data.copy()
|
||||
data_elided['apiKey'] = '<elided>'
|
||||
logger.trace(
|
||||
"pending has at least one of "
|
||||
"('CarrierJump', 'FSDJump', 'Location', 'Docked')"
|
||||
" Attempting API call with the following events:"
|
||||
)
|
||||
# if any(p for p in pending if p['event'] in ('CarrierJump', 'FSDJump', 'Location', 'Docked')):
|
||||
# data_elided = data.copy()
|
||||
# data_elided['apiKey'] = '<elided>'
|
||||
# logger.trace(
|
||||
# "pending has at least one of "
|
||||
# "('CarrierJump', 'FSDJump', 'Location', 'Docked')"
|
||||
# " Attempting API call with the following events:"
|
||||
# )
|
||||
|
||||
for p in pending:
|
||||
logger.trace(f"Event: {p!r}")
|
||||
if p['event'] in ('Location'):
|
||||
logger.trace('Attempting API call for "Location" event with timestamp: '
|
||||
f'{p["timestamp"]}')
|
||||
# for p in pending:
|
||||
# logger.trace(f"Event: {p!r}")
|
||||
# if p['event'] in ('Location'):
|
||||
# logger.trace('Attempting API call for "Location" event with timestamp: '
|
||||
# f'{p["timestamp"]}')
|
||||
|
||||
logger.trace(f'Overall POST data (elided) is:\n{data_elided}')
|
||||
# logger.trace(f'Overall POST data (elided) is:\n{data_elided}')
|
||||
|
||||
r = this.session.post('https://www.edsm.net/api-journal-v1', data=data, timeout=_TIMEOUT)
|
||||
logger.trace(f'API response content: {r.content}')
|
||||
# logger.trace(f'API response content: {r.content}')
|
||||
r.raise_for_status()
|
||||
reply = r.json()
|
||||
msg_num = reply['msgnum']
|
||||
@ -618,10 +618,12 @@ def worker() -> None:
|
||||
else:
|
||||
|
||||
if msg_num // 100 == 1:
|
||||
logger.trace('Overall OK')
|
||||
# logger.trace('Overall OK')
|
||||
pass
|
||||
|
||||
elif msg_num // 100 == 5:
|
||||
logger.trace('Event(s) not currently processed, but saved for later')
|
||||
# logger.trace('Event(s) not currently processed, but saved for later')
|
||||
pass
|
||||
|
||||
else:
|
||||
logger.warning(f'EDSM API call status not 1XX, 2XX or 5XX: {msg.num}')
|
||||
|
@ -336,7 +336,7 @@ else: # Linux / Run from source
|
||||
super().__init__()
|
||||
self.httpd = HTTPServer(('localhost', 0), HTTPRequestHandler)
|
||||
self.redirect = f'http://localhost:{self.httpd.server_port}/auth'
|
||||
logger.trace(f'Web server listening on {self.redirect}')
|
||||
logger.info(f'Web server listening on {self.redirect}')
|
||||
self.thread: Optional[threading.Thread] = None
|
||||
|
||||
def start(self, master) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user