Move to kernel style SPDX license identifiers
[lttng-ust.git] / python-lttngust / lttngust / debug.py
... / ...
CommitLineData
1# -*- coding: utf-8 -*-
2#
3# SPDX-License-Identifier: LGPL-2.1-only
4#
5# Copyright (C) 2015 Philippe Proulx <pproulx@efficios.com>
6
7from __future__ import unicode_literals, print_function
8import lttngust.compat
9import time
10import sys
11import os
12
13
14_ENABLE_DEBUG = os.getenv('LTTNG_UST_PYTHON_DEBUG', '0') == '1'
15
16
17if _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')
31else:
32 def _pwarning(msg):
33 pass
34
35 def _pdebug(msg):
36 pass
This page took 0.023015 seconds and 4 git commands to generate.