File: log_parser.pl

package info (click to toggle)
webmin-cluster 1.180-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,124 kB
  • ctags: 97
  • sloc: perl: 8,823; makefile: 85; sh: 22
file content (29 lines) | stat: -rw-r--r-- 806 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# log_parser.pl
# Functions for parsing this module's logs

do 'cluster-cron-lib.pl';

# parse_webmin_log(user, script, action, type, object, &params)
# Converts logged information from this module into human-readable form
sub parse_webmin_log
{
local ($user, $script, $action, $type, $object, $p, $long) = @_;
if ($action eq 'exec') {
	local @server = split(/\0/, $p->{'run'});
	if ($long) {
		return &text('log_run_l', "<tt>$p->{'cluster_command'}</tt>",
		     join(", ", map { $_ ? "<tt>$_</tt>"
					 : $text{'index_this'} } @server));
		}
	else {
		return &text('log_run', "<tt>$p->{'cluster_command'}</tt>",
					scalar(@server));
		}
	}
else {
	local $l = $long ? "_l" : "";
	return &text("log_${action}${l}", "<tt>$object</tt>",
		     "<tt>".&html_escape($p->{'cluster_command'})."</tt>");
	}
}