From 045d30b82746237ac165f85e13ede0b239dffc56 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Mon, 21 Oct 2019 10:44:15 -0400 Subject: [PATCH] Filter out "not a validator" errors Signed-off-by: Daniel Bluhm --- aries_cloudagent/config/logging.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/aries_cloudagent/config/logging.py b/aries_cloudagent/config/logging.py index 1e2b7ecd45..3ae81468d4 100644 --- a/aries_cloudagent/config/logging.py +++ b/aries_cloudagent/config/logging.py @@ -35,6 +35,14 @@ def load_resource(path: str, encoding: str = None) -> TextIO: pass +def not_a_validator_filter(record): + """Filter out 'not a Validator' errors.""" + if record.name == 'indy.libindy.native.indy.services.pool.pool': + if len(record.args) > 1 and record.args[2].find('Node is not a Validator'): + return 0 + return 1 + + class LoggingConfigurator: """Utility class used to configure logging and print an informative start banner.""" @@ -75,6 +83,10 @@ def configure( log_level = log_level.upper() logging.root.setLevel(log_level) + if logging.root.hasHandlers(): + handler = logging.root.handlers[0] + handler.addFilter(not_a_validator_filter) + @classmethod def print_banner( cls,