flash/nor/at91samd: Use 32-bit register writes for ST-Link compat
[fw/openocd] / tools / logger.pl
1 #!/usr/bin/perl
2 # logger.pl: masks long meaningless output with pretty lines of dots
3 #  Details: 1) reads lines from STDIN and echos them on STDOUT,
4 #           2) print a '.' to STDERR every $N lines.
5 #           3) print a newline after a sequence of $C dots
6
7 use strict;
8 use warnings;
9
10 # make sure all output gets displayed immediately
11 $| = 1;
12
13 # TODO: add -n and -c options w/ zero checks)
14 # line and column limits
15 my $N = 10;
16 my $C = 72;
17
18 # current line and column counters
19 my $n = 0;
20 my $c = 0;
21
22 # read all lines from STDIN
23 while (<STDIN>)
24 {
25         # echo line to output
26         print STDOUT $_;
27         # echo line to console if it is important
28         if (/(Warning|Error)/) {
29                 print STDERR "\n" if $c;
30                 print STDERR $_;
31                 $c = 0;
32         }
33         # only display progress every Nth step
34         next if ++$n % $N;
35         print STDERR ".";
36         # wrap at column C to provide fixed-width rows of dots
37         print STDERR "\n" unless ++$c % $C;
38 }
39
40 print STDERR "\n" if $c;