aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-03 22:31:14 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-03 22:31:14 +0000
commit071dc340295c26f3243f96986e5799234accbc43 (patch)
treee9e24cf4e66c2a0353879d9e8164936542ab4708
parent0922aba3f85a1c0060d612f8dbc4503a7de17b99 (diff)
downloadpaludis-071dc340295c26f3243f96986e5799234accbc43.tar.gz
paludis-071dc340295c26f3243f96986e5799234accbc43.tar.xz
Tinker with logging. More log calls.
-rw-r--r--paludis/log.cc31
-rw-r--r--paludis/log.hh3
-rw-r--r--paludis/portage_repository.cc4
-rw-r--r--paludis/pstream.cc2
4 files changed, 38 insertions, 2 deletions
diff --git a/paludis/log.cc b/paludis/log.cc
index c7a2bfd..09167e8 100644
--- a/paludis/log.cc
+++ b/paludis/log.cc
@@ -29,6 +29,7 @@ namespace paludis
InternalCounted<Implementation<Log> >
{
LogLevel log_level;
+ std::ostream * stream;
};
}
@@ -36,6 +37,7 @@ Log::Log() :
PrivateImplementationPattern<Log>(new Implementation<Log>)
{
_implementation->log_level = initial_ll;
+ _implementation->stream = &std::cerr;
}
Log::~Log()
@@ -52,6 +54,33 @@ void
Log::message(const LogLevel l, const std::string & s)
{
if (l >= _implementation->log_level)
- std::cerr << s << std::endl;
+ {
+ do
+ {
+ switch (l)
+ {
+ case ll_debug:
+ *_implementation->stream << "[DEBUG] ";
+ continue;
+
+ case ll_warning:
+ *_implementation->stream << "[WARNING] ";
+ continue;
+
+ case last_ll:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad value for log_level");
+
+ } while (false);
+
+ *_implementation->stream << s << std::endl;
+ }
}
+void
+Log::set_log_stream(std::ostream * const s)
+{
+ _implementation->stream = s;
+}
diff --git a/paludis/log.hh b/paludis/log.hh
index 7c512e2..91ff3c3 100644
--- a/paludis/log.hh
+++ b/paludis/log.hh
@@ -22,6 +22,7 @@
#include <paludis/instantiation_policy.hh>
#include <paludis/private_implementation_pattern.hh>
+#include <iosfwd>
namespace paludis
{
@@ -51,6 +52,8 @@ namespace paludis
void set_log_level(const LogLevel);
void message(const LogLevel, const std::string &);
+
+ void set_log_stream(std::ostream * const);
};
}
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index e3f98d6..ad92479 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -28,6 +28,7 @@
#include "is_file_with_extension.hh"
#include "key_value_config_file.hh"
#include "line_config_file.hh"
+#include "log.hh"
#include "match_package.hh"
#include "package_database.hh"
#include "package_dep_atom.hh"
@@ -543,6 +544,9 @@ PortageRepository::do_version_metadata(
}
else
{
+ Log::get_instance()->message(ll_warning, "No cache entry for '" + stringify(c) + "/" +
+ stringify(p) + "-" + stringify(v) + "' in '" + stringify(name()) + "'");
+
std::string cmd(
"env P='" + stringify(p) + "-" + stringify(v.remove_revision()) + "' " +
"PV='" + stringify(v.remove_revision()) + "' " +
diff --git a/paludis/pstream.cc b/paludis/pstream.cc
index 73a449b..f5584de 100644
--- a/paludis/pstream.cc
+++ b/paludis/pstream.cc
@@ -58,7 +58,7 @@ PStreamInBuf::PStreamInBuf(const std::string & command) :
_command(command),
fd(popen(command.c_str(), "r"))
{
- Log::get_instance()->message(ll_debug, "DEBUG: popen " + command);
+ Log::get_instance()->message(ll_debug, "popen " + command);
if (0 == fd)
throw PStreamError("popen('" + _command + "', 'r') failed: " +