Move all sources to 'src/'
[lttng-ust.git] / src / python-lttngust / lttngust / debug.py
CommitLineData
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
7from __future__ import unicode_literals, print_function
e7bf4968 8import lttngust.compat
de4dee04
PP
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: {}(): {}'
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')
31else:
32 def _pwarning(msg):
33 pass
34
35 def _pdebug(msg):
36 pass
This page took 0.028121 seconds and 4 git commands to generate.