Module: sip-router
Branch: master
Commit: a6f3d41f5bb23f2a153ca481b495110339c9cb45
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a6f3d41…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Sep 15 00:05:28 2014 +0200
db_mongodb: log query content in debug level
---
modules/db_mongodb/mongodb_dbase.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/modules/db_mongodb/mongodb_dbase.c b/modules/db_mongodb/mongodb_dbase.c
index c6998f9..ba8f0f3 100644
--- a/modules/db_mongodb/mongodb_dbase.c
+++ b/modules/db_mongodb/mongodb_dbase.c
@@ -824,6 +824,7 @@ int db_mongodb_insert(const db1_con_t* _h, const db_key_t* _k, const
db_val_t* _
bson_error_t error;
bson_t *doc = NULL;
char *cname;
+ char *jstr;
char b1;
mgcon = MONGODB_CON(_h);
@@ -860,6 +861,11 @@ int db_mongodb_insert(const db1_con_t* _h, const db_key_t* _k, const
db_val_t* _
if(db_mongodb_bson_add(doc, VAL_TYPE(_v + i), _k[i], _v+i, i)<0)
goto error;
}
+ if(is_printable(L_DBG)) {
+ jstr = bson_as_json (doc, NULL);
+ LM_DBG("insert document: %s\n", jstr);
+ bson_free (jstr);
+ }
if (!mongoc_collection_insert (collection, MONGOC_INSERT_NONE, doc, NULL, &error))
{
LM_ERR("failed to insert in collection: %s\n", error.message);
@@ -893,6 +899,7 @@ int db_mongodb_delete(const db1_con_t* _h, const db_key_t* _k,
bson_error_t error;
bson_t *doc = NULL;
char *cname;
+ char *jstr;
char b1;
mgcon = MONGODB_CON(_h);
@@ -931,6 +938,11 @@ int db_mongodb_delete(const db1_con_t* _h, const db_key_t* _k,
goto error;
}
+ if(is_printable(L_DBG)) {
+ jstr = bson_as_json (doc, NULL);
+ LM_DBG("delete filter document: %s\n", jstr);
+ bson_free (jstr);
+ }
if (!mongoc_collection_remove (collection, MONGOC_REMOVE_NONE,
doc, NULL, &error)) {
LM_ERR("failed to delete in collection: %s\n", error.message);