ソースを参照

modules/debugger: Added dbg.mod_level RPC command

Victor Seva 12 年 前
コミット
dbefbe319b
2 ファイル変更54 行追加3 行削除
  1. 29 3
      modules/debugger/debugger_api.c
  2. 25 0
      modules/debugger/doc/debugger_admin.xml

+ 29 - 3
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}
 };
 

+ 25 - 0
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>