mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 15:57:14 +03:00
EDMarketConnector: Use logger.trace_if(...)
Yes, leaving that 'truncating plain logfile' as plain trace.
This commit is contained in:
parent
2754385281
commit
4433b67c82
@ -416,13 +416,18 @@ In addition to that we utilise one of the user-defined levels as:
|
||||
method provided on `logger`:
|
||||
|
||||
```python
|
||||
logger.trace_if('my-trace-rule', 'my-log-message')
|
||||
logger.trace_if('journal.event.scan', 'my-log-message')
|
||||
```
|
||||
|
||||
The string used to identify this tracing should be related to the
|
||||
**function of the code**, not the particular file, or class, that it is in.
|
||||
This is so that the same string can be used to trace code that spans more
|
||||
than one file, class, or other scope.
|
||||
|
||||
This would then be triggered by running EDMarketConnector with the
|
||||
appropriate command-line arguments:
|
||||
|
||||
EDMarketConnector.py --trace-on my-trace-rule
|
||||
EDMarketConnector.py --trace-on journal.event.scan
|
||||
|
||||
Note that you do **not** also need to specify `--trace`, that's implied.
|
||||
|
||||
|
@ -174,7 +174,7 @@ if __name__ == '__main__': # noqa: C901
|
||||
|
||||
def handle_edmc_callback_or_foregrounding() -> None: # noqa: CCR001
|
||||
"""Handle any edmc:// auth callback, else foreground existing window."""
|
||||
logger.trace('Begin...')
|
||||
logger.trace_if('frontier-auth.windows', 'Begin...')
|
||||
|
||||
if platform == 'win32':
|
||||
|
||||
@ -1108,7 +1108,7 @@ class AppWindow(object):
|
||||
entry = monitor.get_entry()
|
||||
if not entry:
|
||||
# This is expected due to some monitor.py code that appends `None`
|
||||
# logger.trace('No entry from monitor.get_entry()')
|
||||
logger.trace_if('journal.queue', 'No entry from monitor.get_entry()')
|
||||
return
|
||||
|
||||
# Update main window
|
||||
@ -1199,7 +1199,7 @@ class AppWindow(object):
|
||||
return # in CQC
|
||||
|
||||
if not entry['event'] or not monitor.mode:
|
||||
# logger.trace('Startup, returning')
|
||||
logger.trace_if('journal.queue', 'Startup, returning')
|
||||
return # Startup
|
||||
|
||||
if entry['event'] in ['StartUp', 'LoadGame'] and monitor.started:
|
||||
@ -1828,7 +1828,7 @@ sys.path: {sys.path}'''
|
||||
ui_scale = 100
|
||||
config.set('ui_scale', ui_scale)
|
||||
theme.default_ui_scale = root.tk.call('tk', 'scaling')
|
||||
logger.trace(f'Default tk scaling = {theme.default_ui_scale}')
|
||||
logger.trace_if('tk', f'Default tk scaling = {theme.default_ui_scale}')
|
||||
theme.startup_ui_scale = ui_scale
|
||||
root.tk.call('tk', 'scaling', theme.default_ui_scale * float(ui_scale) / 100.0)
|
||||
app = AppWindow(root)
|
||||
|
Loading…
x
Reference in New Issue
Block a user