Browse code

modules/debugger: Added dbg.mod_level RPC command

Victor Seva authored on 17/05/2013 15:48:17
Showing 2 changed files
... ...
@@ -844,14 +844,40 @@ static void  dbg_rpc_trace(rpc_t* rpc, void* ctx)
844 844
 	rpc->add(ctx, "s", "200 ok");
845 845
 }
846 846
 
847
+/**
848
+ *
849
+ */
850
+static const char* dbg_rpc_mod_level_doc[2] = {
851
+	"Specify module log level",
852
+	0
853
+};
854
+
855
+static void dbg_rpc_mod_level(rpc_t* rpc, void* ctx){
856
+	int l;
857
+	str value = {0,0};
858
+
859
+	if (rpc->scan(ctx, "Sd", &value, &l) < 1)
860
+	{
861
+		rpc->fault(ctx, 500, "invalid parameters");
862
+		return;
863
+	}
864
+
865
+	if(dbg_set_mod_debug_level(value.s, value.len, &l)<0)
866
+	{
867
+		rpc->fault(ctx, 500, "cannot store parameter\n");
868
+		return;
869
+	}
870
+	rpc->add(ctx, "s", "200 ok");
871
+}
847 872
 
848 873
 /**
849 874
  *
850 875
  */
851 876
 rpc_export_t dbg_rpc[] = {
852
-	{"dbg.bp",    dbg_rpc_bp,        dbg_rpc_bp_doc,       0},
853
-	{"dbg.ls",    dbg_rpc_list,      dbg_rpc_list_doc,     0},
854
-	{"dbg.trace", dbg_rpc_trace,     dbg_rpc_trace_doc,    0},
877
+	{"dbg.bp",        dbg_rpc_bp,        dbg_rpc_bp_doc,        0},
878
+	{"dbg.ls",        dbg_rpc_list,      dbg_rpc_list_doc,      0},
879
+	{"dbg.trace",     dbg_rpc_trace,     dbg_rpc_trace_doc,     0},
880
+	{"dbg.mod_level", dbg_rpc_mod_level, dbg_rpc_mod_level_doc, 0},
855 881
 	{0, 0, 0, 0}
856 882
 };
857 883
 
... ...
@@ -444,6 +444,31 @@ if($si=="10.0.0.10")
444 444
 		</programlisting>
445 445
     </section>
446 446
 
447
+    <section>
448
+		<title>
449
+		<function moreinfo="none">dbg.mod_level</function>
450
+		</title>
451
+		<para>
452
+			Specify module log level.
453
+		</para>
454
+		<para>
455
+		Name: <emphasis>dbg.mod_level</emphasis>
456
+		</para>
457
+		<para>Parameters:</para>
458
+		<itemizedlist>
459
+			<listitem><para>_module_ : For core log
460
+				level, use module name 'core'</para></listitem>
461
+			<listitem><para>_level_ : integer</para></listitem>
462
+		</itemizedlist>
463
+		<para>
464
+		Examples of use with &sercmd;:
465
+		</para>
466
+        <programlisting  format="linespecific">
467
+		dbg.mod_level core 3
468
+		dbg.mod_level tm 3
469
+		</programlisting>
470
+    </section>
471
+
447 472
     </section>
448 473
 	<section>
449 474
 		<title>Usage</title>