Module: sip-router
Branch: master
Commit: dbefbe319ba13b008ad46576dbc8a00d305e9910
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=dbefbe3…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: Fri May 17 17:48:17 2013 +0200
modules/debugger: Added dbg.mod_level RPC command
---
modules/debugger/debugger_api.c | 32 ++++++++++++++++++++++++++++--
modules/debugger/doc/debugger_admin.xml | 25 ++++++++++++++++++++++++
2 files changed, 54 insertions(+), 3 deletions(-)
diff --git a/modules/debugger/debugger_api.c b/modules/debugger/debugger_api.c
index 7653c95..4a5828d 100644
--- a/modules/debugger/debugger_api.c
+++ b/modules/debugger/debugger_api.c
@@ -844,14 +844,40 @@ static void dbg_rpc_trace(rpc_t* rpc, void* ctx)
rpc->add(ctx, "s", "200 ok");
}
+/**
+ *
+ */
+static const char* dbg_rpc_mod_level_doc[2] = {
+ "Specify module log level",
+ 0
+};
+
+static void dbg_rpc_mod_level(rpc_t* rpc, void* ctx){
+ int l;
+ str value = {0,0};
+
+ if (rpc->scan(ctx, "Sd", &value, &l) < 1)
+ {
+ rpc->fault(ctx, 500, "invalid parameters");
+ return;
+ }
+
+ if(dbg_set_mod_debug_level(value.s, value.len, &l)<0)
+ {
+ rpc->fault(ctx, 500, "cannot store parameter\n");
+ return;
+ }
+ rpc->add(ctx, "s", "200 ok");
+}
/**
*
*/
rpc_export_t dbg_rpc[] = {
- {"dbg.bp", dbg_rpc_bp, dbg_rpc_bp_doc, 0},
- {"dbg.ls", dbg_rpc_list, dbg_rpc_list_doc, 0},
- {"dbg.trace", dbg_rpc_trace, dbg_rpc_trace_doc, 0},
+ {"dbg.bp", dbg_rpc_bp, dbg_rpc_bp_doc, 0},
+ {"dbg.ls", dbg_rpc_list, dbg_rpc_list_doc, 0},
+ {"dbg.trace", dbg_rpc_trace, dbg_rpc_trace_doc, 0},
+ {"dbg.mod_level", dbg_rpc_mod_level, dbg_rpc_mod_level_doc, 0},
{0, 0, 0, 0}
};
diff --git a/modules/debugger/doc/debugger_admin.xml
b/modules/debugger/doc/debugger_admin.xml
index 7df8af1..af56f83 100644
--- a/modules/debugger/doc/debugger_admin.xml
+++ b/modules/debugger/doc/debugger_admin.xml
@@ -444,6 +444,31 @@ if($si=="10.0.0.10")
</programlisting>
</section>
+ <section>
+ <title>
+ <function moreinfo="none">dbg.mod_level</function>
+ </title>
+ <para>
+ Specify module log level.
+ </para>
+ <para>
+ Name: <emphasis>dbg.mod_level</emphasis>
+ </para>
+ <para>Parameters:</para>
+ <itemizedlist>
+ <listitem><para>_module_ : For core log
+ level, use module name 'core'</para></listitem>
+ <listitem><para>_level_ : integer</para></listitem>
+ </itemizedlist>
+ <para>
+ Examples of use with &sercmd;:
+ </para>
+ <programlisting format="linespecific">
+ dbg.mod_level core 3
+ dbg.mod_level tm 3
+ </programlisting>
+ </section>
+
</section>
<section>
<title>Usage</title>