Commit | Line | Data |
---|---|---|
de4dee04 PP |
1 | # -*- coding: utf-8 -*- |
2 | # | |
3 | # Copyright (C) 2015 - Philippe Proulx <pproulx@efficios.com> | |
4 | # | |
5 | # This library is free software; you can redistribute it and/or modify it under | |
6 | # the terms of the GNU Lesser General Public License as published by the Free | |
7 | # Software Foundation; version 2.1 of the License. | |
8 | # | |
9 | # This library is distributed in the hope that it will be useful, but WITHOUT | |
10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
11 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
12 | # details. | |
13 | # | |
14 | # You should have received a copy of the GNU Lesser General Public License | |
15 | # along with this library; if not, write to the Free Software Foundation, Inc., | |
16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | ||
18 | from __future__ import unicode_literals, print_function | |
19 | import time | |
20 | import sys | |
21 | import os | |
22 | ||
23 | ||
24 | _ENABLE_DEBUG = os.getenv('LTTNG_UST_PYTHON_DEBUG', '0') == '1' | |
25 | ||
26 | ||
27 | if _ENABLE_DEBUG: | |
28 | import inspect | |
29 | ||
30 | def _pwarning(msg): | |
31 | fname = inspect.stack()[1][3] | |
32 | fmt = '[{:.6f}] LTTng-UST warning: {}(): {}' | |
33 | print(fmt.format(time.clock(), fname, msg), file=sys.stderr) | |
34 | ||
35 | def _pdebug(msg): | |
36 | fname = inspect.stack()[1][3] | |
37 | fmt = '[{:.6f}] LTTng-UST debug: {}(): {}' | |
38 | print(fmt.format(time.clock(), fname, msg), file=sys.stderr) | |
39 | ||
40 | _pdebug('debug is enabled') | |
41 | else: | |
42 | def _pwarning(msg): | |
43 | pass | |
44 | ||
45 | def _pdebug(msg): | |
46 | pass |