aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-11 14:40:18 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-11 14:40:18 +0000
commit9e7b0aeb4d1e185a2e88f3af1c6ac178cd6b9021 (patch)
tree4605979da591f0471b62152aac1ee6b13e0dcf7d
parent91aab14ab6025f71e1553191abd0b5490359f460 (diff)
downloadpaludis-9e7b0aeb4d1e185a2e88f3af1c6ac178cd6b9021.tar.gz
paludis-9e7b0aeb4d1e185a2e88f3af1c6ac178cd6b9021.tar.xz
Support out of band messages
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/output_manager-fwd.hh6
-rw-r--r--paludis/util/output_manager.cc5
-rw-r--r--paludis/util/output_manager.hh9
-rw-r--r--paludis/util/output_manager.se22
-rw-r--r--paludis/util/standard_output_manager.cc5
-rw-r--r--paludis/util/standard_output_manager.hh1
-rw-r--r--src/clients/cave/cmd_sync.cc4
8 files changed, 53 insertions, 1 deletions
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 44526f4..6e7e055 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -46,7 +46,7 @@ add(`named_value', `hh', `cc', `fwd')
add(`no_type', `hh')
add(`operators', `hh')
add(`options', `hh', `fwd', `cc', `test')
-add(`output_manager', `hh', `fwd', `cc')
+add(`output_manager', `hh', `fwd', `cc', `se')
add(`output_wrapper', `test', `testscript')
add(`pipe', `hh', `cc')
add(`pretty_print', `hh', `cc', `test')
diff --git a/paludis/util/output_manager-fwd.hh b/paludis/util/output_manager-fwd.hh
index 12928c4..3c650aa 100644
--- a/paludis/util/output_manager-fwd.hh
+++ b/paludis/util/output_manager-fwd.hh
@@ -20,8 +20,14 @@
#ifndef PALUDIS_GUARD_PALUDIS_UTIL_OUTPUT_MANAGER_FWD_HH
#define PALUDIS_GUARD_PALUDIS_UTIL_OUTPUT_MANAGER_FWD_HH 1
+#include <paludis/util/attributes.hh>
+#include <iosfwd>
+
namespace paludis
{
+
+#include <paludis/util/output_manager-se.hh>
+
class OutputManager;
}
diff --git a/paludis/util/output_manager.cc b/paludis/util/output_manager.cc
index 7fe0767..0b77326 100644
--- a/paludis/util/output_manager.cc
+++ b/paludis/util/output_manager.cc
@@ -18,9 +18,14 @@
*/
#include <paludis/util/output_manager.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/exception.hh>
+#include <ostream>
using namespace paludis;
+#include <paludis/util/output_manager-se.cc>
+
OutputManager::~OutputManager()
{
}
diff --git a/paludis/util/output_manager.hh b/paludis/util/output_manager.hh
index 736394d..98588d4 100644
--- a/paludis/util/output_manager.hh
+++ b/paludis/util/output_manager.hh
@@ -37,6 +37,15 @@ namespace paludis
virtual std::ostream & stderr_stream() PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
+ * An out of band message that might want to be logged or handled
+ * in a special way.
+ *
+ * The caller must still also display the message to
+ * stdout_stream() as appropriate.
+ */
+ virtual void message(const MessageType, const std::string &) = 0;
+
+ /**
* Called if an action succeeds. This can be used to, for example,
* unlink the files behind a to-disk logged output manager.
*
diff --git a/paludis/util/output_manager.se b/paludis/util/output_manager.se
new file mode 100644
index 0000000..6169844
--- /dev/null
+++ b/paludis/util/output_manager.se
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_MessageType()
+{
+ prefix mt
+
+ key mt_debug "A message only to be kept when debugging"
+ key mt_info "An informational message"
+ key mt_warn "A warning message"
+ key mt_error "An error message"
+ key mt_log "A message explicitly marked for logging"
+
+ doxygen_comment << "END"
+ /**
+ * Type of message for OutputManager.
+ *
+ * \see OutputManager
+ */
+END
+}
+
diff --git a/paludis/util/standard_output_manager.cc b/paludis/util/standard_output_manager.cc
index b819e6f..7416f8d 100644
--- a/paludis/util/standard_output_manager.cc
+++ b/paludis/util/standard_output_manager.cc
@@ -47,3 +47,8 @@ StandardOutputManager::succeeded()
{
}
+void
+StandardOutputManager::message(const MessageType, const std::string &)
+{
+}
+
diff --git a/paludis/util/standard_output_manager.hh b/paludis/util/standard_output_manager.hh
index 8752352..afe2fbc 100644
--- a/paludis/util/standard_output_manager.hh
+++ b/paludis/util/standard_output_manager.hh
@@ -36,6 +36,7 @@ namespace paludis
virtual std::ostream & stderr_stream() PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void succeeded();
+ virtual void message(const MessageType, const std::string &);
};
}
diff --git a/src/clients/cave/cmd_sync.cc b/src/clients/cave/cmd_sync.cc
index e404114..d25d138 100644
--- a/src/clients/cave/cmd_sync.cc
+++ b/src/clients/cave/cmd_sync.cc
@@ -92,6 +92,10 @@ namespace
void succeeded()
{
}
+
+ virtual void message(const MessageType, const std::string &)
+ {
+ }
};
struct SyncCommandLine :