summaryrefslogtreecommitdiff
path: root/Build-tools/logger.pm
diff options
context:
space:
mode:
authorunknown <lenz@mysql.com>2003-02-19 21:02:05 +0100
committerunknown <lenz@mysql.com>2003-02-19 21:02:05 +0100
commit68ee31cf6cee6991c8772ae1ff975b417987ada2 (patch)
tree6a0e1573715c77140d8e77f0bfa32e6a4f9ba747 /Build-tools/logger.pm
parent65508b65ba04d499f900259d52d6b16be871ef4a (diff)
downloadmariadb-git-68ee31cf6cee6991c8772ae1ff975b417987ada2.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) support-files/MacOSX/Description.plist.sh: - Shortened IFPkgDescriptionDescription a bit support-files/MacOSX/Makefile.am: - Added more files (StartupParameters.plist, postinstall, preinstall) to distribution
Diffstat (limited to 'Build-tools/logger.pm')
-rw-r--r--Build-tools/logger.pm51
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";
+}