From e7c3680056f456f702208772e979de5b29adaf6b Mon Sep 17 00:00:00 2001
From: Marco Cattaneo <marco.cattaneo@cern.ch>
Date: Wed, 21 Apr 2021 16:45:33 +0200
Subject: [PATCH] Suppress some warnings when building StrippingCache and
 TurboCache

---
 .../options/SuppressLogMessages.py              |  8 +++++---
 Phys/TurboCache/options/SuppressLogMessages.py  | 17 +++++++++++++++++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/Phys/StrippingCache/options/SuppressLogMessages.py b/Phys/StrippingCache/options/SuppressLogMessages.py
index 9b6cc7e09..3e6919fa7 100644
--- a/Phys/StrippingCache/options/SuppressLogMessages.py
+++ b/Phys/StrippingCache/options/SuppressLogMessages.py
@@ -29,14 +29,16 @@ IGNORED_MESSAGES = map(re.compile,
                         r'has prescale <= 0',
                         r'share the same output location',
                         r'how to add new bank',
-                        r'Using default tag.*for partition',
+                        r'Using default tag .* for partition .*',
                         r'The lines going to MDST.DST are',
                         r'No explicit tuning for DataType',
                         r'something else configured a decoder already',
                         r'REMOVE UT decoding from DataOnDemand',
                         r'Applied corrections configured via options for',
-                        r'requesting factory via old name'
-                       ))
+                        r'requesting factory via old name',
+                        r'Property .* is set in both .* and .*, using .*',
+                        r'No line has been selected to go to the FTAG stream .*'
+                        ))
 
 _orig_log_filter = log.filter
 def old_stripping_filter(record):
diff --git a/Phys/TurboCache/options/SuppressLogMessages.py b/Phys/TurboCache/options/SuppressLogMessages.py
index 00ffa8c0a..bdb638a47 100644
--- a/Phys/TurboCache/options/SuppressLogMessages.py
+++ b/Phys/TurboCache/options/SuppressLogMessages.py
@@ -13,3 +13,20 @@ from GaudiKernel.ProcessJobOptions import GetConsoleHandler
 
 # Do not print any of the messages with level lower than WARNING
 GetConsoleHandler().disable(allowed=logging.WARNING)
+
+from Gaudi.Configuration import log
+import re
+
+IGNORED_MESSAGES = map(re.compile, (r'Using default tag .* for partition .*',))
+
+_orig_log_filter = log.filter
+def turbo_cache_filter(record):
+    '''
+    Hide known warnings in TurboCache.
+    '''
+    if record.levelno >= logging.WARNING:
+        if any(exp.search(record.msg) for exp in IGNORED_MESSAGES): return False
+        if not record.msg.strip(): return False # why should anyone want to print an empty warning?
+    return _orig_log_filter(record)
+
+log.filter = turbo_cache_filter
-- 
GitLab