diff options
author | Johannes Winkelmann <jw@smts.ch> | 2006-04-07 07:49:13 +0000 |
---|---|---|
committer | Johannes Winkelmann <jw@smts.ch> | 2006-04-07 07:49:13 +0000 |
commit | 5634324b6525fd1f95d40e6ed4e3126ca55ce50a (patch) | |
tree | eb8cf0ef4dce5875bb8b85aac36e160695929aa5 /src | |
parent | ec36dcd199752b66013fe8530006e08aee9a76ed (diff) | |
download | prt-get-5634324b6525fd1f95d40e6ed4e3126ca55ce50a.tar.gz prt-get-5634324b6525fd1f95d40e6ed4e3126ca55ce50a.tar.xz |
prt-get: add timestamps to log files
git-svn-id: https://crux.nu/svn/tools/prt-get/trunk@1170 0b5ae1c7-2405-0410-a7fc-ba219f786e1e
Diffstat (limited to 'src')
-rw-r--r-- | src/installtransaction.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/installtransaction.cpp b/src/installtransaction.cpp index e75d1b8..c1f7718 100644 --- a/src/installtransaction.cpp +++ b/src/installtransaction.cpp @@ -18,6 +18,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <time.h> using namespace std; @@ -191,7 +192,13 @@ InstallTransaction::installPackage( const Package* package, int fdlog = -1; string logFile = ""; + string timestamp; + string commandName = "prt-get"; + if ( parser->wasCalledAsPrtCached() ) { + commandName = "prt-cache"; + } + if ( m_config->writeLog() ) { logFile = m_config->logFilePattern(); if ( logFile == "" ) { @@ -228,6 +235,12 @@ InstallTransaction::installPackage( const Package* package, if ( fdlog == -1 ) { return LOG_FILE_FAILURE; } + + time_t startTime; + time(&startTime); + timestamp = ctime(&startTime); + timestamp = commandName + ": starting build " + timestamp; + write( fdlog, timestamp.c_str(), timestamp.length()); } string pkgdir = package->path() + "/" + package->name(); @@ -304,10 +317,6 @@ InstallTransaction::installPackage( const Package* package, package->version() + "-" + package->release() + ".pkg.tar.gz"; - string commandName = "prt-get"; - if ( parser->wasCalledAsPrtCached() ) { - commandName = "prt-cache"; - } // - inform the user about what's happening string fullCommand = commandName + ": " + cmd + " " + args; @@ -328,9 +337,17 @@ InstallTransaction::installPackage( const Package* package, cout << fullCommand << endl; } if ( m_config->writeLog() ) { + time_t endTime; + time(&endTime); + timestamp = ctime(&endTime); + timestamp = commandName + ": build done " + timestamp; + write( fdlog, summary.c_str(), summary.length() ); + write( fdlog, "\n", 1 ); write( fdlog, fullCommand.c_str(), fullCommand.length() ); write( fdlog, "\n", 1 ); + write( fdlog, timestamp.c_str(), timestamp.length()); + write( fdlog, "\n", 1 ); } Process installProc( cmd, args, fdlog ); |