Handle hostnames with upper-case letters
[webmin.git] / init / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'init-lib.pl';
5
6 # parse_webmin_log(user, script, action, type, object, &params)
7 # Converts logged information from this module into human-readable form
8 sub parse_webmin_log
9 {
10 local ($user, $script, $action, $type, $object, $p) = @_;
11 if ($action eq 'modify') {
12         if ($p->{'old'} ne $p->{'name'}) {
13                 return &text('log_rename', "<tt>$p->{'old'}</tt>",
14                                            "<tt>$p->{'name'}</tt>");
15                 }
16         else {
17                 return &text('log_modify', "<tt>$object</tt>");
18                 }
19         }
20 elsif ($action eq 'create') {
21         return &text('log_create', "<tt>$object</tt>");
22         }
23 elsif ($action eq 'delete') {
24         return &text('log_delete', "<tt>$object</tt>");
25         }
26 elsif ($type eq 'action') {
27         return &text('log_'.$action, "<tt>$object</tt>");
28         }
29 elsif ($action eq 'reboot') {
30         return $text{'log_reboot'};
31         }
32 elsif ($action eq 'shutdown') {
33         return $text{'log_shutdown'};
34         }
35 elsif ($action eq 'local') {
36         return $text{'log_local'};
37         }
38 elsif ($action eq 'bootup') {
39         return &text('log_bootup', join(", ", map { "<tt>$_</tt>" } keys %$p));
40         }
41 elsif ($action eq 'massstart' || $action eq 'massstop' ||
42        $action eq 'massrestart' ||
43        $action eq 'massenable' || $action eq 'massdisable') {
44         return &text('log_'.$action, join(", ", map { "<tt>$_</tt>" } split(/\s+/, $object)));
45         }
46 elsif ($action eq 'telinit') {
47         return &text('log_telinit', $object);
48         }
49 else {
50         return undef;
51         }
52 }
53