Start a module to log
This commit is contained in:
parent
114e661761
commit
d0420fe9f3
2 changed files with 184 additions and 134 deletions
43
ACU/Log.pm
Normal file
43
ACU/Log.pm
Normal 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;
|
||||
Reference in a new issue