Move to kernel style SPDX license identifiers
[babeltrace.git] / src / bindings / python / bt2 / bt2 / logging.py
CommitLineData
0235b0db 1# SPDX-License-Identifier: MIT
811644b8
PP
2#
3# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
811644b8 4
493d384f 5from bt2 import native_bt
811644b8
PP
6
7
8class LoggingLevel:
ef267d12 9 TRACE = native_bt.LOGGING_LEVEL_TRACE
811644b8
PP
10 DEBUG = native_bt.LOGGING_LEVEL_DEBUG
11 INFO = native_bt.LOGGING_LEVEL_INFO
770538dd 12 WARNING = native_bt.LOGGING_LEVEL_WARNING
811644b8
PP
13 ERROR = native_bt.LOGGING_LEVEL_ERROR
14 FATAL = native_bt.LOGGING_LEVEL_FATAL
15 NONE = native_bt.LOGGING_LEVEL_NONE
16
17
18def get_minimal_logging_level():
19 return native_bt.logging_get_minimal_level()
20
21
22def get_global_logging_level():
23 return native_bt.logging_get_global_level()
24
25
26def set_global_logging_level(level):
27 levels = (
ef267d12 28 LoggingLevel.TRACE,
811644b8
PP
29 LoggingLevel.DEBUG,
30 LoggingLevel.INFO,
770538dd 31 LoggingLevel.WARNING,
811644b8
PP
32 LoggingLevel.ERROR,
33 LoggingLevel.FATAL,
34 LoggingLevel.NONE,
35 )
36
37 if level not in levels:
38 raise TypeError("'{}' is not a valid logging level".format(level))
39
40 return native_bt.logging_set_global_level(level)
This page took 0.066214 seconds and 4 git commands to generate.