summaryrefslogtreecommitdiff
path: root/libcult/cult/trace/stream.hxx
diff options
context:
space:
mode:
authorJörg Frings-Fürst <jff@merkur>2014-05-18 16:08:14 +0200
committerJörg Frings-Fürst <jff@merkur>2014-05-18 16:08:14 +0200
commita15cf65c44d5c224169c32ef5495b68c758134b7 (patch)
tree3419f58fc8e1b315ba8171910ee044c5d467c162 /libcult/cult/trace/stream.hxx
Imported Upstream version 3.3.0.2upstream/3.3.0.2
Diffstat (limited to 'libcult/cult/trace/stream.hxx')
-rw-r--r--libcult/cult/trace/stream.hxx74
1 files changed, 74 insertions, 0 deletions
diff --git a/libcult/cult/trace/stream.hxx b/libcult/cult/trace/stream.hxx
new file mode 100644
index 0000000..728e973
--- /dev/null
+++ b/libcult/cult/trace/stream.hxx
@@ -0,0 +1,74 @@
+// file : cult/trace/stream.hxx
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2005-2010 Boris Kolpackov
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef CULT_TRACE_STREAM_HXX
+#define CULT_TRACE_STREAM_HXX
+
+#include <cult/types/fundamental.hxx>
+
+#include <cult/trace/log.hxx>
+#include <cult/trace/record.hxx>
+
+namespace Cult
+{
+ namespace Trace
+ {
+ class Stream: public NonCopyable
+ {
+ public:
+ Stream (Char const* id, Int level, Log& l = Log::instance ());
+
+ public:
+ Char const*
+ id () const;
+
+ Int
+ level () const;
+
+ public:
+ Stream&
+ operator<< (Record const& r);
+
+ private:
+ struct Mediator
+ {
+ ~Mediator ();
+ Mediator (Stream&);
+
+ Stream& s_;
+ Record r_;
+ };
+
+ friend Record&
+ operator<< (Mediator const&, Int level);
+
+ friend Record&
+ operator<< (Mediator const&, Char const* s);
+
+ template <typename T>
+ friend Record&
+ operator<< (Mediator const&, T const& arg);
+
+ private:
+ Char const* id_;
+ Int level_;
+ Log& log_;
+ };
+ }
+}
+
+#ifndef CULT_TRACE_NULL
+
+#include <cult/trace/stream.ixx>
+#include <cult/trace/stream.txx>
+
+#else
+
+#include <cult/trace/null/stream.ixx>
+#include <cult/trace/null/stream.txx>
+
+#endif
+
+#endif // CULT_TRACE_STREAM_HXX