From 043fd4d8267a6e17d06db735b7099681525a8cda Mon Sep 17 00:00:00 2001
From: norohind <60548839+norohind@users.noreply.github.com>
Date: Thu, 12 Aug 2021 16:01:31 +0300
Subject: [PATCH] inara.py: put inara events trace logging under `inara-events`
 trace_on option

---
 plugins/inara.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/inara.py b/plugins/inara.py
index ea46f9ce..48515856 100644
--- a/plugins/inara.py
+++ b/plugins/inara.py
@@ -22,6 +22,7 @@ from companion import CAPIData
 from config import applongname, appversion, config, debug_senders
 from EDMCLogging import get_main_logger
 from ttkHyperlinkLabel import HyperlinkLabel
+import config as conf_module  # Necessary to see the same config.trace_on as elsewhere
 
 logger = get_main_logger()
 
@@ -1491,7 +1492,9 @@ def new_worker():
                 ]
             }
             logger.info(f'sending {len(data["events"])} events for {creds.cmdr}')
-            logger.trace(f'Events:\n{json.dumps(data)}\n')
+            if 'inara-events' in conf_module.trace_on:
+                logger.trace(f'Events:\n{json.dumps(data)}\n')
+
             try_send_data(TARGET_URL, data)
 
         time.sleep(WORKER_WAIT_TIME)