diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-11-12 03:42:18 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-11-12 03:42:18 +0100 |
commit | 81deaa81713656c48320b0ca0e89384a3eca0616 (patch) | |
tree | 82ec6486b792167cd70fa70405590a989295c298 | |
parent | 8f2b5a1a2d281056afdc06e5edf190703ca205ef (diff) | |
download | psutil-81deaa81713656c48320b0ca0e89384a3eca0616.tar.gz |
add psutil_debug() utility function
-rw-r--r-- | psutil/_psutil_common.c | 10 | ||||
-rw-r--r-- | psutil/_psutil_common.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c index d023f12b..74a0479d 100644 --- a/psutil/_psutil_common.c +++ b/psutil/_psutil_common.c @@ -77,6 +77,16 @@ psutil_set_testing(PyObject *self, PyObject *args) { /* + * Print a debug message on stderr. No-op if PSUTIL_DEBUG env var is not set. + */ +void +psutil_debug(char *msg) { + if (PSUTIL_DEBUG) + fprintf(stderr, "psutil-debug> %s\n", msg); +} + + +/* * Called on module import on all platforms. */ void diff --git a/psutil/_psutil_common.h b/psutil/_psutil_common.h index 3c36a6fe..c90cae7c 100644 --- a/psutil/_psutil_common.h +++ b/psutil/_psutil_common.h @@ -21,4 +21,5 @@ PyObject* AccessDenied(void); PyObject* NoSuchProcess(void); PyObject* psutil_set_testing(PyObject *self, PyObject *args); +void psutil_debug(char *msg); void psutil_setup(void); |