Handle hostnames with upper-case letters
[webmin.git] / squid / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'squid-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 $object = &html_escape($object);
12 if ($type eq 'acl') {
13         return &text("log_acl_$action", "<tt>$object</tt>");
14         }
15 elsif ($type eq 'host') {
16         return &text("log_host_$action", "<tt>$object</tt>");
17         }
18 elsif ($type eq 'http' || $type eq 'icp' ||
19        $type eq 'always' || $type eq 'never' ||
20        $type eq 'pool' || $type eq 'delay' ||
21        $type eq 'headeracc' || $type eq 'refresh') {
22         return &text("log_${type}_${action}",
23                      "<tt>".&html_escape($object)."</tt>");
24         }
25 elsif ($type eq 'pools' || $type eq 'refreshes' || $type eq 'hosts') {
26         return &text("log_${type}_${action}", $object);
27         }
28 elsif ($type eq 'user') {
29         return &text("log_user_$action", "<tt>$object</tt>");
30         }
31 elsif ($action eq 'purge') {
32         return &text('log_purge', "<tt>".&html_escape($object)."</tt>");
33         }
34 elsif ($text{"log_$action"}) {
35         return $text{"log_$action"};
36         }
37 else {
38         return undef;
39         }
40 }
41