| 1 | # -*- coding: utf-8 -*- |
| 2 | # |
| 3 | # SPDX-License-Identifier: LGPL-2.1-only |
| 4 | # |
| 5 | # Copyright (C) 2015 Philippe Proulx <pproulx@efficios.com> |
| 6 | |
| 7 | from __future__ import unicode_literals, print_function |
| 8 | import lttngust.compat |
| 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: {}(): {}' |
| 23 | print(fmt.format(lttngust.compat._clock(), fname, msg), file=sys.stderr) |
| 24 | |
| 25 | def _pdebug(msg): |
| 26 | fname = inspect.stack()[1][3] |
| 27 | fmt = '[{:.6f}] LTTng-UST debug: {}(): {}' |
| 28 | print(fmt.format(lttngust.compat._clock(), fname, msg), file=sys.stderr) |
| 29 | |
| 30 | _pdebug('debug is enabled') |
| 31 | else: |
| 32 | def _pwarning(msg): |
| 33 | pass |
| 34 | |
| 35 | def _pdebug(msg): |
| 36 | pass |