From 8acae50b3b03336fae62053fcfb206dbfda20164 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Wed, 21 Jun 2023 13:15:48 +0200 Subject: [PATCH] refactor --- src/de/p1st/monitor/logger.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/de/p1st/monitor/logger.py b/src/de/p1st/monitor/logger.py index e892d23..9bedf5f 100644 --- a/src/de/p1st/monitor/logger.py +++ b/src/de/p1st/monitor/logger.py @@ -24,9 +24,12 @@ class Logger(ABC): # Either both variables are given, or both are None if warn_if_above is not None and critical_if_above is not None: - assert critical_if_above > warn_if_above + if critical_if_above <= warn_if_above: + raise Exception(f'The critical limit is not greater that the warning limit:' + f' {critical_if_above}, {warn_if_above}') else: - assert warn_if_above is None and critical_if_above is None + if warn_if_above is not None or critical_if_above is not None: + raise Exception('Either both, warn_if_above and critical_if_above, must be given, or both must be None.') self.warn_if_above = warn_if_above self.critical_if_above = critical_if_above