diff options
author | dwight <dwight@10gen.com> | 2010-08-22 17:23:50 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-09-15 14:40:53 -0400 |
commit | 5191e5f0f5d4b1905a4775657b9cdf6bc1daf58e (patch) | |
tree | c8dde08394ba70a2eae3d1f8649e31ff9623662f | |
parent | b6f400ef69dc683289edd03340f6794088b91507 (diff) | |
download | mongo-5191e5f0f5d4b1905a4775657b9cdf6bc1daf58e.tar.gz |
rawOut more
-rw-r--r-- | util/util.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/util/util.cpp b/util/util.cpp index 60127b63e2b..c7bc20a4315 100644 --- a/util/util.cpp +++ b/util/util.cpp @@ -156,27 +156,21 @@ namespace mongo { } printStackTrace(); } - + + /* note: can't use malloc herein - may be in signal handler. + logLockless() likely does not comply and should still be fixed todo + */ void rawOut( const string &s ) { if( s.empty() ) return; - char smallbuf[512]; - char *buf = smallbuf; - if( s.size() + 20 + 10 > 512 ) { - // don't use the heap unless the output is really big. that way rawOut("out of memory") is ok. - buf = new char[32 + s.size()]; - } - + char buf[64]; time_t_to_String( time(0) , buf ); buf[20] = ' '; - strncpy( buf + 21 , s.c_str() , s.size() ); - buf[21+s.size()] = '\n'; - buf[21+s.size()+1] = 0; - - Logstream::logLockless( buf ); + buf[21] = 0; - if( buf != smallbuf ) - delete[] buf; + Logstream::logLockless(buf); + Logstream::logLockless(s); + Logstream::logLockless("\n"); } ostream& operator<<( ostream &s, const ThreadSafeString &o ){ |