X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Futils.py;h=4329d93fa17565f31dcf4aaec06e33a5e1132c36;hb=e874da19b9fd96ac87f70595e0463f8e03af29af;hp=b564fcad1b486aa57ae2b27ca613d6ff3f517eb9;hpb=0ee90b745f28a543f7cc355591b36bddfe3a30e1;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/utils.py b/src/bindings/python/bt2/bt2/utils.py index b564fcad..4329d93f 100644 --- a/src/bindings/python/bt2/bt2/utils.py +++ b/src/bindings/python/bt2/bt2/utils.py @@ -21,6 +21,7 @@ # THE SOFTWARE. import bt2 +import bt2.logging def _check_bool(o): @@ -125,3 +126,20 @@ def _handle_ret(ret, msg=None): def _handle_ptr(ptr, msg=None): if ptr is None: _raise_bt2_error(msg) + + +def _check_log_level(log_level): + _check_int(log_level) + + log_levels = ( + bt2.logging.LoggingLevel.VERBOSE, + bt2.logging.LoggingLevel.DEBUG, + bt2.logging.LoggingLevel.INFO, + bt2.logging.LoggingLevel.WARN, + bt2.logging.LoggingLevel.ERROR, + bt2.logging.LoggingLevel.FATAL, + bt2.logging.LoggingLevel.NONE, + ) + + if log_level not in log_levels: + raise ValueError("'{}' is not a valid logging level".format(log_level))