Workshop o mikrokontrolérech na SKSP 2024.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

34 lines
558 B

#
# Perl module for Logging
#
# (c) 2007 Pavel Charvat <pchar@ucw.cz>
#
package UCW::Log;
use lib 'lib/perl5';
use strict;
use warnings;
use POSIX;
use Exporter;
our $version = 1.0;
our @ISA = qw(Exporter);
our @EXPORT = ();
our %EXPORT_TAGS = ( all => [qw(&Log &Die)]);
our @EXPORT_OK = (@{$EXPORT_TAGS{'all'}});
my $Prog = (reverse split(/\//, $0))[0];
sub Log {
my $level = shift;
my $text = join(' ', @_);
print STDERR $level, strftime(" %Y-%m-%d %H:%M:%S ", localtime()), "[$Prog] ", $text, "\n";
}
sub Die {
Log('!', @_);
exit 1;
}
1;