diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-08-09 18:18:13 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-08-09 18:18:13 +0200 |
commit | 462d315247610e4223a0a94096e93b6036068e98 (patch) | |
tree | e8a378bf3acc20661711f7971ddaafcd9d4b9868 /src/mintdb | |
parent | 2cccc2a17336da8417ecaa4dabb1f99ee6dd99a1 (diff) | |
download | exchange-462d315247610e4223a0a94096e93b6036068e98.tar.xz |
silence useless PQ logging
Diffstat (limited to 'src/mintdb')
-rw-r--r-- | src/mintdb/plugin_mintdb_postgres.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/mintdb/plugin_mintdb_postgres.c b/src/mintdb/plugin_mintdb_postgres.c index b0f378e4b..57455fcce 100644 --- a/src/mintdb/plugin_mintdb_postgres.c +++ b/src/mintdb/plugin_mintdb_postgres.c @@ -166,7 +166,7 @@ static int postgres_drop_temporary (void *cls, struct TALER_MINTDB_Session *session) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Dropping temporary tables\n"); SQLEXEC_ (session->conn, "DROP SCHEMA " TALER_TEMP_SCHEMA_NAME " CASCADE;"); @@ -177,6 +177,40 @@ postgres_drop_temporary (void *cls, /** + * Function called by libpq whenever it wants to log something. + * We already log whenever we care, so this function does nothing + * and merely exists to silence the libpq logging. + * + * @param arg NULL + * @param res information about some libpq event + */ +static void +pq_notice_receiver_cb (void *arg, + const PGresult *res) +{ + /* do nothing, intentionally */ +} + + +/** + * Function called by libpq whenever it wants to log something. + * We log those using the Taler logger. + * + * @param arg NULL + * @param message information about some libpq event + */ +static void +pq_notice_processor_cb (void *arg, + const char *message) +{ + GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, + "pq", + "%s", + message); +} + + +/** * Create the necessary tables if they are not present * * @param cls the `struct PostgresClosure` with the plugin-specific state @@ -198,6 +232,12 @@ postgres_create_tables (void *cls, PQfinish (conn); return GNUNET_SYSERR; } + PQsetNoticeReceiver (conn, + &pq_notice_receiver_cb, + NULL); + PQsetNoticeProcessor (conn, + &pq_notice_processor_cb, + NULL); if ( (GNUNET_YES == temporary) && (GNUNET_SYSERR == set_temporary_schema (conn))) { @@ -939,6 +979,12 @@ postgres_get_session (void *cls, GNUNET_break (0); return NULL; } + PQsetNoticeReceiver (db_conn, + &pq_notice_receiver_cb, + NULL); + PQsetNoticeProcessor (db_conn, + &pq_notice_processor_cb, + NULL); if ( (GNUNET_YES == temporary) && (GNUNET_SYSERR == set_temporary_schema(db_conn)) ) { |