diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-09-03 13:37:20 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-09-03 13:37:20 -0400 |
commit | cf46ccabe432382af30adb450cf339730daea718 (patch) | |
tree | c204eefb7724de69d2b46c4735af62eace7b924b /util/log.h | |
parent | 2470913c7012b3d14a013a88bee3ee405705bf59 (diff) | |
download | mongo-cf46ccabe432382af30adb450cf339730daea718.tar.gz |
fix logstream and shared_ptr
Diffstat (limited to 'util/log.h')
-rw-r--r-- | util/log.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/util/log.h b/util/log.h index 1d0dec3adda..2ba5d04cb56 100644 --- a/util/log.h +++ b/util/log.h @@ -97,13 +97,6 @@ namespace mongo { } template< class T > Nullstream& operator<<(const shared_ptr<T> p ){ - /* - T * t = p.get(); - if ( ! t ) - *this << "null"; - else - *this << t; - */ return *this; } template< class T > @@ -121,6 +114,7 @@ namespace mongo { extern Nullstream nullstream; #define LOGIT { boostlock lk(mutex); cout << x; return *this; } + class Logstream : public Nullstream { static boost::mutex &mutex; public: @@ -158,6 +152,17 @@ namespace mongo { cout << _hex; return *this; } + + template< class T > + Nullstream& operator<<(const shared_ptr<T> p ){ + T * t = p.get(); + if ( ! t ) + *this << "null"; + else + *this << t; + return *this; + } + Logstream& prolog(bool withNs = false) { char now[64]; time_t_to_String(time(0), now); @@ -169,6 +174,7 @@ namespace mongo { cout << curNs << ' '; return *this; } + }; extern Logstream logstream; |