summaryrefslogtreecommitdiff
path: root/lib/sbin/Logger.pl
blob: 971b628f3ddbd221fa6cb89486774fe6aa193341 (plain)
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
#! /usr/bin/perl -s
#/*@@
#  @file      Logger
#  @date      Thu April 19 14:25:13 2004
#  @author    Yaakoub El-Khamra
#  @desc
#             Logs configuration scripts
#  @enddesc
#  @version   $Header$
#@@*/


require "$sbin_dir/CSTUtils.pl";

#/*@@
#  @routine   CreateLogFile
#  @date
#  @author    Yaakoub El-Khamra
#  @desc
#  Writes logs of configuration scripts
#  @enddesc
#@@*/
sub CreateLogFile
{
  my($config_dir, $cfg, $thorns)=@_;
  my($data) = '';

  foreach $thorn (sort keys %thorns)
  {
    if ($cfg->{"\U$thorn\E PROVIDES"})
    {
      foreach $provides (split (' ', $cfg->{"\U$thorn\E PROVIDES"}))
      {
        $data .= "Configuration Script log for thorn: $thorn:\n";
        $data .= $cfg->{"\U$thorn $provides\E MESSAGE"};
        $data .= $cfg->{"\U$thorn $provides\E ERROR"};
      }
    }
  }

  &WriteFile("$config_dir/ConfigScripts.log", \$data);

}


1;