diff options
author | lenz@mysql.com <> | 2003-02-19 21:02:05 +0100 |
---|---|---|
committer | lenz@mysql.com <> | 2003-02-19 21:02:05 +0100 |
commit | 3e75d7771de711b4ff03bdc9af6aa2d383da1d41 (patch) | |
tree | 6a0e1573715c77140d8e77f0bfa32e6a4f9ba747 /Build-tools/logger.pm | |
parent | 126e0857499a730458cca7f243a634b8f30be826 (diff) | |
download | mariadb-git-3e75d7771de711b4ff03bdc9af6aa2d383da1d41.tar.gz |
- added more files to support-files/MacOSX and added them to the
distribution
- added Bootstrap, logger.pm and Do-pkg to Build-tools:
Bootstrap is used to build the source distribution for the binary builds
logger.pm includes some helper functions
Do-pkg converts a binary distribution into a Mac OS X PKG (still needs
some polishing)
Diffstat (limited to 'Build-tools/logger.pm')
-rw-r--r-- | Build-tools/logger.pm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Build-tools/logger.pm b/Build-tools/logger.pm new file mode 100644 index 00000000000..f0426ab5e5a --- /dev/null +++ b/Build-tools/logger.pm @@ -0,0 +1,51 @@ +# +# Create a log entry +# +sub logger +{ + my $message=$_[0]; + print timestamp() . " " . $message . "\n" if $opt_verbose; + if (defined $opt_log && !$opt_dry_run) + { + open LOG, ">>$logfile" or die "Can't open logfile $logfile!"; + print LOG timestamp() . " " . $message . "\n"; + close LOG; + } +} + +# Create a time stamp for logging purposes +sub timestamp +{ + return &ymd() . " " . &hms(); +} + +# +# return the current time as a string (HH:MM:SS) +# +sub hms +{ + my @ta= localtime(time()); + my $h= $ta[2]; + $h= "0" . "$h" if ($h <= 9); + my $m= $ta[1]; + $m= "0" . "$m" if ($m <= 9); + my $s= $ta[0]; + $s="0" . "$s" if ($s <= 9); + + return "$h:$m:$s"; +} + +# +# return the current date as a string (YYYYMMDD) +# +sub ymd +{ + my @ta=localtime(time()); + my $d=$ta[3]; + $d="0" . "$d" if ($d <= 9); + my $m=$ta[4]+1; + $m="0" . "$m" if ($m <= 9); + my $y=1900+$ta[5]; + + return "$y$m$d"; +} |