Option to limit debug log to one module
authorJamie Cameron <jcameron@webmin.com>
Fri, 13 Nov 2009 00:54:52 +0000 (16:54 -0800)
committerJamie Cameron <jcameron@webmin.com>
Fri, 13 Nov 2009 00:54:52 +0000 (16:54 -0800)
web-lib-funcs.pl
webmin/CHANGELOG
webmin/change_debug.cgi
webmin/edit_debug.cgi
webmin/lang/en

index baaee94..e935ee5 100755 (executable)
@@ -4725,6 +4725,10 @@ sub webmin_debug_log
 my ($type, $msg) = @_;
 return 0 if (!$main::opened_debug_log);
 return 0 if ($gconfig{'debug_no'.$main::webmin_script_type});
+if ($gconfig{'debug_modules'}) {
+       my @dmods = split(/\s+/, $gconfig{'debug_modules'});
+       return 0 if (&indexof($main::initial_module_name, @dmods) < 0);
+       }
 my $now = time();
 my @tm = localtime($now);
 my $line = sprintf
index 467c47b..f2b14e1 100644 (file)
@@ -95,3 +95,5 @@ Added a field to the Operating System and Environment page for additional Perl m
 ---- Changes since 1.480 ----
 Removed the option to select an OSDN mirror, as Sourceforge now does sensible location-based redirects automatically.
 Added an option on the Logging page to record logins and logouts from Webmin, for display in the Webmin Actions Log module.
+---- Changes since 1.490 ----
+Added a field to the Debugging Log File page to select modules to debug for.
index 12c3378..44b363e 100755 (executable)
@@ -42,6 +42,15 @@ $gconfig{'debug_noweb'} = !$in{'debug_web'};
 $gconfig{'debug_nocmd'} = !$in{'debug_cmd'};
 $gconfig{'debug_nocron'} = !$in{'debug_cron'};
 
+# Modules
+if ($in{'mall'}) {
+       delete($gconfig{'debug_modules'});
+       }
+else {
+       $in{'modules'} || &error($text{'debug_emodules'});
+       $gconfig{'debug_modules'} = join(' ', split(/\0/, $in{'modules'}));
+       }
+
 # Write out
 &write_file("$config_directory/config", \%gconfig);
 &unlock_file("$config_directory/config");
index 94ac52c..0f7274e 100755 (executable)
@@ -41,6 +41,17 @@ print &ui_table_row($text{'debug_procs'},
        &ui_checkbox("debug_cron", 1, $text{'debug_cron'},
                     !$gconfig{'debug_nocron'}));
 
+# Modules to debug
+# Modules to log in
+print &ui_table_row($text{'debug_inmods'},
+       &ui_radio("mall", $gconfig{'debug_modules'} ? 0 : 1,
+                 [ [ 1, $text{'log_mall'} ], [ 0, $text{'log_modules'} ] ]).
+       "<br>\n".
+       &ui_select("modules", [ split(/\s+/, $gconfig{'debug_modules'}) ],
+                  [ map { [ $_->{'dir'}, $_->{'desc'} ] }
+                        sort { $a->{'desc'} cmp $b->{'desc'} }
+                             &get_all_module_infos() ], 5, 1));
+
 print &ui_table_end();
 print &ui_form_end([ [ "save", $text{'save'} ] ]);
 
index 3b50656..9ae384e 100644 (file)
@@ -855,9 +855,12 @@ debug_efile=Debug log file must be an absolute path
 debug_edir=Directory '$1' for debug log file does not exist
 debug_esize=Maximum size must be a number
 debug_procs=Script types to debug
+debug_modules=Limit debugging to modules
 debug_web=Web interface CGIs
 debug_cmd=Command line
 debug_cron=Background jobs
+debug_inmods=Modules to write debug logs for
+debug_emodules=No modules to debug for selected
 
 notif_passexpired=Your Webmin password has expired! You will be forced to change it at the next login.
 notif_passchange=Your Webmin password was last changed on $1, and must be changed in $2 days.