-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f77463
commit ff692e5
Showing
9 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package ParCzech::PipeLine::Logger; | ||
|
||
use warnings; | ||
use strict; | ||
use open qw(:std :utf8); | ||
use utf8; | ||
use DateTime; | ||
|
||
|
||
sub new { | ||
my $this = shift; | ||
my $class = ref($this) || $this; | ||
my %opts = @_; | ||
my $self = {}; | ||
bless $self, $class; | ||
$self->{prefix} = $opts{prefix} if defined $opts{prefix}; | ||
$self->{tz} = DateTime::TimeZone->new( name => 'local' ) // DateTime::TimeZone->new( name => 'floating' ) // DateTime::TimeZone->new( name => 'UTC' ); | ||
return $self | ||
} | ||
|
||
|
||
sub log_line { | ||
my $self = shift; | ||
my $date = DateTime->now(time_zone => $self->{tz})->strftime('%Y-%m-%d %T'); | ||
print STDERR "$date\t",$self->get_prefix,join(' ',@_),"\n"; | ||
} | ||
|
||
sub get_prefix { | ||
my $self = shift; | ||
return '' unless defined $self->{prefix}; | ||
return "($self->{prefix}) "; | ||
} | ||
|
||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters