Skip to content

Commit

Permalink
Added log_warn(), log_error(), log_info() and log_debug() to Rex::Log…
Browse files Browse the repository at this point in the history
…ger.
  • Loading branch information
kablamo committed Dec 3, 2015
1 parent bef1890 commit fa5efa8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/Rex/Logger.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ use warnings;

# VERSION

#use Rex;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(log_debug log_info log_warn log_error);
our %EXPORT_TAGS = (all => [@EXPORT_OK]);

our $no_color = 0;
eval "use Term::ANSIColor";
Expand Down Expand Up @@ -105,7 +108,7 @@ sub init {
$log_opened = 1;
}

sub info {
sub logger {
my ( $msg, $type ) = @_;
my $color = 'green';

Expand Down Expand Up @@ -171,6 +174,16 @@ sub info {
}
}

sub log_error { logger( shift, "error" ) }
sub log_warn { logger( shift, "warn" ) }
sub log_info { logger( shift, "info" ) }
sub log_debug { debug(@_) }

sub error { logger( shift, "error" ) }
sub warn { logger( shift, "warn" ) }
sub info { logger( shift, "info" ) }


sub debug {
my ($msg) = @_;
return if $silent;
Expand Down

0 comments on commit fa5efa8

Please sign in to comment.