File: log_parser.pl

package info (click to toggle)
webmin 1.180-3sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 16,900 kB
  • ctags: 2,152
  • sloc: perl: 55,792; java: 1,362; sh: 980; ansic: 221; makefile: 191
file content (48 lines) | stat: -rw-r--r-- 1,160 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# log_parser.pl
# Functions for parsing this module's logs

do 'init-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) = @_;
if ($action eq 'modify') {
	if ($p->{'old'} ne $p->{'name'}) {
		return &text('log_rename', "<tt>$p->{'old'}</tt>",
					   "<tt>$p->{'name'}</tt>");
		}
	else {
		return &text('log_modify', "<tt>$object</tt>");
		}
	}
elsif ($action eq 'create') {
	return &text('log_create', "<tt>$object</tt>");
	}
elsif ($action eq 'delete') {
	return &text('log_delete', "<tt>$object</tt>");
	}
elsif ($action eq 'start') {
	return &text('log_start', "<tt>$object</tt>");
	}
elsif ($action eq 'stop') {
	return &text('log_stop', "<tt>$object</tt>");
	}
elsif ($action eq 'reboot') {
	return $text{'log_reboot'};
	}
elsif ($action eq 'shutdown') {
	return $text{'log_shutdown'};
	}
elsif ($action eq 'local') {
	return $text{'log_local'};
	}
elsif ($action eq 'bootup') {
	return &text('log_bootup', join(" , ", map { "<tt>$_</tt>" } keys %$p));
	}
else {
	return undef;
	}
}