3 $col_white = "\033[00m";
4 $col_black = "\033[30m";
6 $col_green = "\033[32m";
7 $col_yellow = "\033[33m";
8 $col_blue = "\033[34m";
9 $col_purple = "\033[35m";
10 $col_cyan = "\033[36m";
11 $col_ltgray = "\033[37m";
12 $col_darkgray = "\033[30m";
14 $col_norm = $col_white;
15 $col_background = "\033[07m";
16 $col_brighten = "\033[01m";
17 $col_underline = "\033[04m";
18 $col_blink = "\033[05m";
20 # Customize colors here...
22 $col_default = $col_ltgray;
24 $col_green, $col_yellow,
25 $col_purple, $col_cyan,
27 $col_background . $col_green,
28 $col_background . $col_yellow, $col_background . $col_purple,
29 $col_background . $col_cyan, $col_background . $col_red,
30 $col_background . $col_blue, $col_background . $col_magenta,
37 while (($_ = $ARGV[0]) =~ /^-/) {
40 $opt_print_location = 1; shift;
41 } elsif (/-h(elp)?$|-u(sage)?$/i) {
43 colorize.pl - Log colorizer for SimGrid
46 colorize.pl [options] <file>
48 where <file> is a text file of values or '-' for STDIN
50 Options: () denote short version
52 -location Print the location in the code of the message.
62 unless (defined($pid{$pid})) {
63 # first time we see this pid. Affect it a color
64 $pid{$pid}=(scalar keys %pid) % (scalar @coltab);
66 return $coltab[$pid{$pid}];
70 my($host,$procname,$pid,$date,$location,$xbt_channel,$message)=@_;
73 printf "[% 10.6f]",$date;
77 if(defined($location)) {
78 printf "[%10s:%-10s] %s ",$host,$procname,$location;
80 printf "[%10s:%-10s]",$host,$procname;
86 # Read the messages and do the job
88 $orgline = $thisline = $_;
90 # Typical line [Gatien:slave:(9) 11.243148] msg/gos.c:137: [msg_gos/DEBUG] Action terminated
91 if ($thisline =~ /^\[(.+):([^:]+):\((\d+)\) ([\d\.]*)\] ([^\[]*) \[([^\[]*)\] (.*)$/) {
96 if($opt_print_location) {
105 print_line($host,$procname,$pid,$date,$location,$xbt_channel,$message);
106 # Typical line [Boivin:slave:(2) 9.269357] [pmm/INFO] ROW: step(2)<>myrow(0). Receive data from TeX
107 } elsif ($thisline =~ /^\[([^:]+):([^:]+):\((\d+)\) ([\d\.]*)\] \[([^\[]*)\] (.*)$/) {
114 print_line($host,$procname,$pid,$date,undef,$xbt_channel,$message);
115 } elsif ( $thisline =~ /^==(\d+)== (.*)$/) {
116 # take care of valgrind outputs
117 print pidcolor($1)."$2\n";
120 print $col_default. $orgline;