Commit | Line | Data |
---|---|---|
de4dee04 PP |
1 | # -*- coding: utf-8 -*- |
2 | # | |
c0c0989a | 3 | # SPDX-License-Identifier: LGPL-2.1-only |
de4dee04 | 4 | # |
c0c0989a | 5 | # Copyright (C) 2015 Philippe Proulx <pproulx@efficios.com> |
de4dee04 PP |
6 | |
7 | from __future__ import unicode_literals, print_function | |
e7bf4968 | 8 | import lttngust.compat |
de4dee04 PP |
9 | import time |
10 | import sys | |
11 | import os | |
12 | ||
13 | ||
14 | _ENABLE_DEBUG = os.getenv('LTTNG_UST_PYTHON_DEBUG', '0') == '1' | |
15 | ||
16 | ||
17 | if _ENABLE_DEBUG: | |
18 | import inspect | |
19 | ||
20 | def _pwarning(msg): | |
21 | fname = inspect.stack()[1][3] | |
22 | fmt = '[{:.6f}] LTTng-UST warning: {}(): {}' | |
e7bf4968 | 23 | print(fmt.format(lttngust.compat._clock(), fname, msg), file=sys.stderr) |
de4dee04 PP |
24 | |
25 | def _pdebug(msg): | |
26 | fname = inspect.stack()[1][3] | |
27 | fmt = '[{:.6f}] LTTng-UST debug: {}(): {}' | |
e7bf4968 | 28 | print(fmt.format(lttngust.compat._clock(), fname, msg), file=sys.stderr) |
de4dee04 PP |
29 | |
30 | _pdebug('debug is enabled') | |
31 | else: | |
32 | def _pwarning(msg): | |
33 | pass | |
34 | ||
35 | def _pdebug(msg): | |
36 | pass |