aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-19 17:17:12 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-19 17:17:12 +0000
commitcf3a1a38c42c3ce40dabf70a3a2818978eb5b108 (patch)
tree597fb21750a90d93d38dac4b15a0e6ac5df22d82
parent0279d59df48f32bc7e1172d5b2df7000cb518e78 (diff)
downloadpaludis-cf3a1a38c42c3ce40dabf70a3a2818978eb5b108.tar.gz
paludis-cf3a1a38c42c3ce40dabf70a3a2818978eb5b108.tar.xz
Add program name and time to log messages. Add debug messages for operations that are expected to be slow.
-rwxr-xr-xebuild/ebuild.bash2
-rw-r--r--ebuild/echo_functions.bash1
-rw-r--r--paludis/util/log.cc12
-rw-r--r--paludis/util/log.hh5
-rw-r--r--paludis/vdb_repository.cc4
-rw-r--r--src/paludis.cc2
6 files changed, 26 insertions, 0 deletions
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index d0f9dad..dcf61df 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -32,6 +32,8 @@ alias die='diefunc "$FUNCNAME" "$LINENO"'
alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ -z "${_pipestatus//[ 0]/}" ]] || diefunc "$FUNCNAME" "$LINENO" "$_pipestatus"'
trap 'echo "die trap: exiting with error." 1>&2 ; exit 250' 15
+export EBUILD_PROGRAM_NAME="$0"
+
diefunc()
{
local func="$1" line="$2"
diff --git a/ebuild/echo_functions.bash b/ebuild/echo_functions.bash
index d6aca5f..522b397 100644
--- a/ebuild/echo_functions.bash
+++ b/ebuild/echo_functions.bash
@@ -75,6 +75,7 @@ ebuild_notice()
if [[ "${level_num}" -ge "${min_level_num}" ]] ; then
local upper_level=$(echo ${level} | ${ebuild_real_tr:-tr} '[:lower:]' '[:upper:]' )
+ echo -n "${EBUILD_PROGRAM_NAME:-ebuild.bash}@$(date +%s ): "
echo "[${upper_level}.EBUILD] $* (from ${EBUILD:-?})" 1>&2
fi
true
diff --git a/paludis/util/log.cc b/paludis/util/log.cc
index 158bfdd..7c9a687 100644
--- a/paludis/util/log.cc
+++ b/paludis/util/log.cc
@@ -36,6 +36,9 @@ namespace paludis
/// Current output stream
std::ostream * stream;
+
+ /// Program name
+ std::string program_name;
};
}
@@ -44,6 +47,7 @@ Log::Log() :
{
_imp->log_level = initial_ll;
_imp->stream = &std::cerr;
+ _imp->program_name = "paludis";
}
Log::~Log()
@@ -67,6 +71,7 @@ Log::message(const LogLevel l, const std::string & s)
{
if (l >= _imp->log_level)
{
+ *_imp->stream << _imp->program_name << "@" << ::time(0) << ": ";
do
{
switch (l)
@@ -127,3 +132,10 @@ Log::log_level_string() const
throw InternalError(PALUDIS_HERE, "Bad log level");
}
+
+void
+Log::set_program_name(const std::string & s)
+{
+ _imp->program_name = s;
+}
+
diff --git a/paludis/util/log.hh b/paludis/util/log.hh
index 870f4d3..8c2a8c2 100644
--- a/paludis/util/log.hh
+++ b/paludis/util/log.hh
@@ -88,6 +88,11 @@ namespace paludis
* Log level, as a string.
*/
std::string log_level_string() const;
+
+ /**
+ * Set our program name.
+ */
+ void set_program_name(const std::string &);
};
}
diff --git a/paludis/vdb_repository.cc b/paludis/vdb_repository.cc
index b178b67..bfd3b1c 100644
--- a/paludis/vdb_repository.cc
+++ b/paludis/vdb_repository.cc
@@ -653,6 +653,8 @@ VDBRepository::begin_provide_map() const
{
Context context("When loading VDB PROVIDEs map:");
+ Log::get_instance()->message(ll_debug, "Starting VDB PROVIDEs map creation");
+
if (! _imp->entries_valid)
_imp->load_entries();
@@ -700,6 +702,8 @@ VDBRepository::begin_provide_map() const
}
}
+ Log::get_instance()->message(ll_debug, "Done VDB PROVIDEs map creation");
+
_imp->has_provide_map = true;
}
diff --git a/src/paludis.cc b/src/paludis.cc
index e055143..4f483d7 100644
--- a/src/paludis.cc
+++ b/src/paludis.cc
@@ -75,6 +75,8 @@ main(int argc, char *argv[])
else
throw DoHelp("bad value for --log-level");
+ p::Log::get_instance()->set_program_name(argv[0]);
+
if (1 != (CommandLine::get_instance()->a_query.specified() +
CommandLine::get_instance()->a_version.specified() +
CommandLine::get_instance()->a_install.specified() +