Hi,
Might be useful to add it to the ext dir
Ohad
On Wed, Sep 8, 2010 at 8:34 AM, Amos Shapira <amos.shapira@gmail.com>
wrote:
> Hi,
>
> We find the "color-coded" puppet logs very useful, but they are
not
> coloured when logged to a file.
>
> Here is a small Perl script to add the color back when reading that
> file. I''d like to upload it to the Wiki but not sure where would
it
> fit (and didn''t find the way to add a new page).
>
> I offer it under GPL v3.
>
> #!/usr/bin/perl
>
> # colorpuppetlog: colorise puppet log according to the severity
> mentioned in the message
>
> # Copyright (c) Amos Shapira, September 8th 2010.
> # Licence: GPLv3
>
> use strict;
> use warnings;
> use Term::ANSIColor;
>
> my %colormap = (
> ''info'' => ''green'',
> ''notice'' => ''cyan'',
> ''err'' => ''magenta'',
> ''warning'' => ''yellow'');
>
> my $color = ''reset'';
>
> while (<>)
> {
> my $newcolor;
> if (/ \((info|notice|err|warning)\): /)
> {
> $newcolor = $colormap{$1};
> }
> else
> {
> $newcolor = ''reset'';
> }
>
> if ($newcolor ne $color)
> {
> $color = $newcolor;
> print color($color);
> }
> print;
> }
>
> print color ''reset'';
>
> exit 0;
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
>
puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.