Handle hostnames with upper-case letters
[webmin.git] / cron / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'cron-lib.pl';
5
6 # parse_webmin_log(user, script, action, type, object, &params, [long])
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, $long) = @_;
11 if ($type eq "env") {
12         return &text('log_env_'.$action, "<tt>$object</tt>");
13         }
14 elsif ($type eq "crons") {
15         return &text('log_crons_'.$action, $object);
16         }
17 elsif ($action eq "move") {
18         return &text('log_move', "<tt>$object</tt>");
19         }
20 elsif ($action eq 'modify') {
21         return &text($long ? 'log_modify_l' : 'log_modify',
22                      "<tt>$object</tt>",
23                      "<tt>".&html_escape($p->{'cmd'})."</tt>");
24         }
25 elsif ($action eq 'create') {
26         return &text($long ? 'log_create_l' : 'log_create',
27                      "<tt>$object</tt>",
28                      "<tt>".&html_escape($p->{'cmd'})."</tt>");
29         }
30 elsif ($action eq 'delete') {
31         return &text($long ? 'log_delete_l' : 'log_delete',
32                      "<tt>$object</tt>",
33                      "<tt>".&html_escape($p->{'command'})."</tt>");
34         }
35 elsif ($action eq 'exec' || $action eq 'kill') {
36         return &text($long ? 'log_'.$action.'_l' : 'log_'.$action,
37                      "<tt>$object</tt>",
38                      "<tt>".&html_escape($p->{'command'})."</tt>");
39         }
40 elsif ($action eq 'allow') {
41         return $text{'log_allow'};
42         }
43 else {
44         return undef;
45         }
46 }
47