Handle hostnames with upper-case letters
[webmin.git] / net / log_parser.pl
1 # log_parser.pl
2 # Functions for parsing this module's logs
3
4 do 'net-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 ($type eq 'host') {
12         return &text("log_${action}_host", "<tt>$object</tt>");
13         }
14 elsif ($type eq 'ipnode') {
15         return &text("log_${action}_ipnode", "<tt>$object</tt>");
16         }
17 elsif ($type eq 'hosts' || $type eq 'ipnodes' ||
18        $type eq 'aifcs' || $type eq 'bifcs') {
19         return &text("log_${action}_${type}", $object);
20         }
21 elsif ($action eq 'dns') {
22         return $text{'log_dns'};
23         }
24 elsif ($action eq 'routes') {
25         return $text{'log_routes'};
26         }
27 elsif ($type eq 'aifc' || $type eq 'bifc') {
28         return &text("log_${action}_${type}", "<tt>$object</tt>",
29                      $p->{'dhcp'} || $p->{'bootp'} ? $text{'log_dyn'} :
30                      "<tt>$p->{'address'}</tt>");
31         }
32 elsif ($type eq 'route' && $action eq 'create') {
33         if ($object) {
34                 return &text('log_create_route',
35                              "<tt>".&html_escape($object)."</tt>");
36                 }
37         else {
38                 return &text('log_create_defroute');
39                 }
40         }
41 elsif ($type eq 'routes' && $action eq 'delete') {
42         return &text('log_delete_routes', $object);
43         }
44 else {
45         return undef;
46         }
47 }
48