blob: 728e97383407b5f0e475634b5479557245b1cc61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
|