This commit is contained in:
Daniel Langbein 2023-06-21 13:15:48 +02:00
parent ceace1ba3e
commit 8acae50b3b

View File

@ -24,9 +24,12 @@ class Logger(ABC):
# Either both variables are given, or both are None # Either both variables are given, or both are None
if warn_if_above is not None and critical_if_above is not 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: 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.warn_if_above = warn_if_above
self.critical_if_above = critical_if_above self.critical_if_above = critical_if_above