summaryrefslogtreecommitdiff
path: root/libcult/cult/trace
diff options
context:
space:
mode:
Diffstat (limited to 'libcult/cult/trace')
-rw-r--r--libcult/cult/trace/log.cxx49
-rw-r--r--libcult/cult/trace/log.hxx51
-rw-r--r--libcult/cult/trace/log.ixx20
-rw-r--r--libcult/cult/trace/null/record.ixx45
-rw-r--r--libcult/cult/trace/null/record.txx18
-rw-r--r--libcult/cult/trace/null/stream.ixx67
-rw-r--r--libcult/cult/trace/null/stream.txx18
-rw-r--r--libcult/cult/trace/record.hxx86
-rw-r--r--libcult/cult/trace/record.ixx45
-rw-r--r--libcult/cult/trace/record.txx19
-rw-r--r--libcult/cult/trace/stream.hxx74
-rw-r--r--libcult/cult/trace/stream.ixx76
-rw-r--r--libcult/cult/trace/stream.txx19
13 files changed, 0 insertions, 587 deletions
diff --git a/libcult/cult/trace/log.cxx b/libcult/cult/trace/log.cxx
deleted file mode 100644
index f77c2c3..0000000
--- a/libcult/cult/trace/log.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-// file : cult/trace/log.cxx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-#include <cult/trace/log.hxx>
-
-#include <iostream>
-
-namespace Cult
-{
- namespace Trace
- {
- Log::
- Log (Int level)
- : level_ (level)
- {
- }
-
- Int Log::
- level () const
- {
- return level_;
- }
-
- Void Log::
- level (Int level)
- {
- level_ = level;
- }
-
- Log& Log::
- instance ()
- {
- //@@ Need to use -once initialization. Plus is it legal to
- // use trace in (static) dtors?
- //
- static Log log;
- return log;
- }
-
- Void Log::
- log_impl (Record const& r)
- {
- std::cerr << '[' << r.id () << ':' << r.level () << "] " << r.text ()
- << std::endl;
- }
- }
-}
diff --git a/libcult/cult/trace/log.hxx b/libcult/cult/trace/log.hxx
deleted file mode 100644
index 2b21acf..0000000
--- a/libcult/cult/trace/log.hxx
+++ /dev/null
@@ -1,51 +0,0 @@
-// file : cult/trace/log.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_LOG_HXX
-#define CULT_TRACE_LOG_HXX
-
-#include <cult/types/fundamental.hxx>
-
-#include <cult/trace/record.hxx>
-
-namespace Cult
-{
- namespace Trace
- {
- class Log: public NonCopyable
- {
- public:
- Log (Int level = -1);
-
- public:
- Int
- level () const;
-
- Void
- level (Int level);
-
- public:
- //@@ should it be virtual?
- //
- Log&
- operator<< (Record const& r);
-
- public:
- static Log&
- instance ();
-
- private:
- Void
- log_impl (Record const& r);
-
- private:
- Int level_;
- };
- }
-}
-
-#include <cult/trace/log.ixx>
-
-#endif // CULT_TRACE_LOG_HXX
diff --git a/libcult/cult/trace/log.ixx b/libcult/cult/trace/log.ixx
deleted file mode 100644
index fbc23d9..0000000
--- a/libcult/cult/trace/log.ixx
+++ /dev/null
@@ -1,20 +0,0 @@
-// file : cult/trace/log.ixx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-namespace Cult
-{
- namespace Trace
- {
- inline
- Log& Log::
- operator<< (Record const& r)
- {
- if (r.level () <= level_)
- log_impl (r);
-
- return *this;
- }
- }
-}
diff --git a/libcult/cult/trace/null/record.ixx b/libcult/cult/trace/null/record.ixx
deleted file mode 100644
index c93b1a0..0000000
--- a/libcult/cult/trace/null/record.ixx
+++ /dev/null
@@ -1,45 +0,0 @@
-// file : cult/trace/null/record.ixx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-namespace Cult
-{
- namespace Trace
- {
- inline
- Record::
- Record (Char const* id, Int level)
- : id_ (id), level_ (level)
- {
- }
-
- inline
- Char const* Record::
- text () const
- {
- return "";
- }
-
- inline
- Char const* Record::
- id () const
- {
- return id_;
- }
-
- inline
- Int Record::
- level () const
- {
- return level_;
- }
-
- inline
- Void Record::
- level (Int level)
- {
- level_ = level;
- }
- }
-}
diff --git a/libcult/cult/trace/null/record.txx b/libcult/cult/trace/null/record.txx
deleted file mode 100644
index 1413f1e..0000000
--- a/libcult/cult/trace/null/record.txx
+++ /dev/null
@@ -1,18 +0,0 @@
-// file : cult/trace/null/record.txx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-namespace Cult
-{
- namespace Trace
- {
- template <typename T>
- inline
- Record& Record::
- operator<< (T const&)
- {
- return *this;
- }
- }
-}
diff --git a/libcult/cult/trace/null/stream.ixx b/libcult/cult/trace/null/stream.ixx
deleted file mode 100644
index 45b6e78..0000000
--- a/libcult/cult/trace/null/stream.ixx
+++ /dev/null
@@ -1,67 +0,0 @@
-// file : cult/trace/null/stream.ixx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-namespace Cult
-{
- namespace Trace
- {
- inline
- Stream::
- Stream (Char const* id, Int level, Log& l)
- : id_ (id), level_ (level), log_ (l)
- {
- }
-
- inline
- Char const* Stream::
- id () const
- {
- return id_;
- }
-
- inline
- Int Stream::
- level () const
- {
- return level_;
- }
-
- inline
- Stream& Stream::
- operator << (Record const& r)
- {
- return *this;
- }
-
- inline
- Stream::Mediator::
- Mediator (Stream& s)
- : s_ (s), r_ (s.id (), s.level ())
- {
- }
-
- inline
- Stream::Mediator::
- ~Mediator ()
- {
- }
-
- inline
- Record&
- operator<< (Stream::Mediator const& mc, Int level)
- {
- Stream::Mediator& m (const_cast<Stream::Mediator&> (mc));
- // m.r_.level (level);
- return m.r_;
- }
-
- inline
- Record&
- operator<< (Stream::Mediator const& mc, Char const* s)
- {
- return const_cast<Stream::Mediator&> (mc).r_;
- }
- }
-}
diff --git a/libcult/cult/trace/null/stream.txx b/libcult/cult/trace/null/stream.txx
deleted file mode 100644
index e9ab70c..0000000
--- a/libcult/cult/trace/null/stream.txx
+++ /dev/null
@@ -1,18 +0,0 @@
-// file : cult/trace/null/stream.txx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-namespace Cult
-{
- namespace Trace
- {
- template <typename T>
- inline
- Record&
- operator<< (Stream::Mediator const& mc, T const&)
- {
- return const_cast<stream::mediator&> (mc).r_;
- }
- }
-}
diff --git a/libcult/cult/trace/record.hxx b/libcult/cult/trace/record.hxx
deleted file mode 100644
index 90276dd..0000000
--- a/libcult/cult/trace/record.hxx
+++ /dev/null
@@ -1,86 +0,0 @@
-// file : cult/trace/record.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_RECORD_HXX
-#define CULT_TRACE_RECORD_HXX
-
-#include <cult/types/fundamental.hxx>
-
-#include <cstring> // memset
-#include <ostream>
-#include <streambuf>
-
-namespace Cult
-{
- namespace Trace
- {
- class Record: public NonCopyable
- {
- public:
- Record (Char const* id, Int level);
-
- public:
- Char const*
- text () const;
-
- Char const*
- id () const;
-
- Int
- level () const;
-
- Void
- level (Int);
-
- public:
- template <typename T>
- Record&
- operator<< (T const& arg);
-
- private:
- Char const* id_;
- Int level_;
-
- //@@ need to wrap streambuf.
- //
- class FixedBuffer : public std::streambuf
- {
- public:
- FixedBuffer (Char* buf, Size size)
- {
- std::memset (buf, 0, size);
- setp (buf, buf + size - 1);
- };
-
- virtual int_type
- overflow (int_type c)
- {
- return c;
- }
- };
-
-#ifndef CULT_TRACE_NULL
- char buf_[1024];
- FixedBuffer sbuf_;
- std::ostream os_;
-#endif
- };
- }
-}
-
-#ifndef CULT_TRACE_NULL
-
-#include <cult/trace/record.ixx>
-#include <cult/trace/record.txx>
-
-#else
-
-#include <cult/trace/null/record.ixx>
-#include <cult/trace/null/record.txx>
-
-#endif
-
-
-#endif // CULT_TRACE_RECORD_HXX
diff --git a/libcult/cult/trace/record.ixx b/libcult/cult/trace/record.ixx
deleted file mode 100644
index ae564a4..0000000
--- a/libcult/cult/trace/record.ixx
+++ /dev/null
@@ -1,45 +0,0 @@
-// file : cult/trace/record.ixx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-namespace Cult
-{
- namespace Trace
- {
- inline
- Record::
- Record (Char const* id, Int level)
- : id_ (id), level_ (level), sbuf_ (buf_, sizeof (buf_)), os_ (&sbuf_)
- {
- }
-
- inline
- Char const* Record::
- text () const
- {
- return buf_;
- }
-
- inline
- Char const* Record::
- id () const
- {
- return id_;
- }
-
- inline
- Int Record::
- level () const
- {
- return level_;
- }
-
- inline
- Void Record::
- level (Int level)
- {
- level_ = level;
- }
- }
-}
diff --git a/libcult/cult/trace/record.txx b/libcult/cult/trace/record.txx
deleted file mode 100644
index 0c4ef1b..0000000
--- a/libcult/cult/trace/record.txx
+++ /dev/null
@@ -1,19 +0,0 @@
-// file : cult/trace/record.txx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-namespace Cult
-{
- namespace Trace
- {
- template <typename T>
- inline
- Record& Record::
- operator<< (T const& arg)
- {
- os_ << arg;
- return *this;
- }
- }
-}
diff --git a/libcult/cult/trace/stream.hxx b/libcult/cult/trace/stream.hxx
deleted file mode 100644
index 728e973..0000000
--- a/libcult/cult/trace/stream.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-// 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
diff --git a/libcult/cult/trace/stream.ixx b/libcult/cult/trace/stream.ixx
deleted file mode 100644
index 718383c..0000000
--- a/libcult/cult/trace/stream.ixx
+++ /dev/null
@@ -1,76 +0,0 @@
-// file : cult/trace/stream.ixx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-namespace Cult
-{
- namespace Trace
- {
- // Stream::Mediator
- //
- inline
- Stream::Mediator::
- Mediator (Stream& s)
- : s_ (s), r_ (s.id (), s.level ())
- {
- }
-
- inline
- Stream::Mediator::
- ~Mediator ()
- {
- s_ << r_;
- }
-
- // Stream
- //
- inline
- Stream::
- Stream (Char const* id, Int level, Log& log)
- : id_ (id), level_ (level), log_ (log)
- {
- }
-
- inline
- char const* Stream::
- id () const
- {
- return id_;
- }
-
- inline
- int Stream::
- level () const
- {
- return level_;
- }
-
- //
- //
- inline
- Stream& Stream::
- operator << (Record const& r)
- {
- log_ << r;
- return *this;
- }
-
- inline
- Record&
- operator<< (Stream::Mediator const& mc, Int level)
- {
- Stream::Mediator& m (const_cast<Stream::Mediator&> (mc));
- m.r_.level (level);
- return m.r_;
- }
-
- inline
- Record&
- operator<< (Stream::Mediator const& mc, Char const* s)
- {
- Stream::Mediator& m (const_cast<Stream::Mediator&> (mc));
- return m.r_ << s;
- }
- }
-}
diff --git a/libcult/cult/trace/stream.txx b/libcult/cult/trace/stream.txx
deleted file mode 100644
index 1ac20ed..0000000
--- a/libcult/cult/trace/stream.txx
+++ /dev/null
@@ -1,19 +0,0 @@
-// file : cult/trace/stream.txx
-// author : Boris Kolpackov <boris@kolpackov.net>
-// copyright : Copyright (c) 2005-2010 Boris Kolpackov
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-namespace Cult
-{
- namespace Trace
- {
- template <typename T>
- inline
- Record&
- operator<< (Stream::Mediator const& mc, T const& arg)
- {
- Stream::Mediator& m (const_cast<Stream::Mediator&> (mc));
- return m.r_ << arg;
- }
- }
-}