Archived
1
0
Fork 0

Start a module to log

This commit is contained in:
Mercier Pierre-Olivier 2013-09-03 06:58:16 +02:00
commit d0420fe9f3
2 changed files with 184 additions and 134 deletions

43
ACU/Log.pm Normal file
View file

@ -0,0 +1,43 @@
#! /usr/bin/env perl
package ACU::Log;
use v5.10.1;
use strict;
use warnings;
use Term::ANSIColor qw(:constants);
our $verbosity = 1;
our $debug = 0;
sub do_err(@)
{
say BOLD, RED, ">>>", RESET, " ", BOLD, @_, RESET;
exit(1);
}
sub do_usage(@)
{
say BOLD, MAGENTA, " * ", RESET, " ", BOLD, @_, RESET;
}
sub do_warn(@)
{
say BOLD, YELLOW, ">>>", RESET, " ", BOLD, @_, RESET;
}
sub do_info(@)
{
if ($verbosity) {
say BOLD, CYAN, " * ", RESET, " ", @_, RESET;
}
}
sub do_debug(@)
{
if ($debug) {
say BOLD, BLUE, " * ", RESET, " ", @_, RESET;
}
}
1;