diff options
| author | James Henstridge <james@jamesh.id.au> | 2007-12-22 13:03:41 +0000 |
|---|---|---|
| committer | James Henstridge <james@jamesh.id.au> | 2007-12-22 13:03:41 +0000 |
| commit | 5fe08ae83e07aef2c7f9a56962d1ef28acf58b4d (patch) | |
| tree | d8b9774e4b099abff02b77327cb36487c1915238 /psycopg/psycopgmodule.c | |
| parent | f3e74d2c4892499a62264a733924e849c10e343e (diff) | |
| download | psycopg2-5fe08ae83e07aef2c7f9a56962d1ef28acf58b4d.tar.gz | |
2007-12-22 James Henstridge <james@jamesh.id.au>
* psycopg/config.h: only print debug messages if
psycopg_debug_enabled is true.
* psycopg/psycopgmodule.c (init_psycopg): set
psycopg_debug_enabled to true if the $PSYCOPG_DEBUG environment
variable is set.
Diffstat (limited to 'psycopg/psycopgmodule.c')
| -rw-r--r-- | psycopg/psycopgmodule.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index 2c4be8c..26cc500 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -63,6 +63,10 @@ PyObject *pyPsycopgTzFixedOffsetTimezone = NULL; PyObject *psycoEncodings = NULL; +#ifdef PSYCOPG_DEBUG +int psycopg_debug_enabled = 0; +#endif + /** connect module-level function **/ #define psyco_connect_doc \ "connect(dsn, ...) -- Create a new database connection.\n\n" \ @@ -693,6 +697,11 @@ init_psycopg(void) PyObject *module, *dict; PyObject *c_api_object; +#ifdef PSYCOPG_DEBUG + if (getenv("PSYCOPG_DEBUG")) + psycopg_debug_enabled = 1; +#endif + Dprintf("initpsycopg: initializing psycopg %s", PSYCOPG_VERSION); /* initialize all the new types and then the module */ |
