diff options
author | Dwight Merriman <dwight@10gen.com> | 2010-05-15 11:44:03 -0400 |
---|---|---|
committer | Dwight Merriman <dwight@10gen.com> | 2010-05-15 11:44:03 -0400 |
commit | 63b7b35c7c3df010391a70b492554ab966e1c3e7 (patch) | |
tree | 66740285abd88e265203ae306eeaeef33ba20b1d /util/log.h | |
parent | acc5d31ed22ad3b83da39ca05b09543b25b63845 (diff) | |
download | mongo-63b7b35c7c3df010391a70b492554ab966e1c3e7.tar.gz |
change log.h
Diffstat (limited to 'util/log.h')
-rw-r--r-- | util/log.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/util/log.h b/util/log.h index 5d582c0304a..da8508fd1a8 100644 --- a/util/log.h +++ b/util/log.h @@ -19,6 +19,7 @@ #include <string.h> #include <errno.h> +#include "../bson/util/builder.h" #ifndef _WIN32 //#include <syslog.h> @@ -132,22 +133,20 @@ namespace mongo { static mongo::mutex mutex; static int doneSetup; stringstream ss; - char _dummy[32]; public: static int magicNumber(){ return 1717; } void flush(Tee *t = 0) { // this ensures things are sane - if ( doneSetup == 1717 ){ + if ( doneSetup == 1717 ) { + BufBuilder b(512); + time_t_to_String( time(0) , b.grow(20) ); + b.append( ss.str() ); + const char *s = b.buf(); + scoped_lock lk(mutex); - - string s = ss.str(); - const char * cc = s.c_str(); - - time_t_to_String( time(0) , _dummy ); - strncpy( (char*)cc , _dummy , 20 ); - + if( t ) t->write(s); #ifndef _WIN32 //syslog( LOG_INFO , "%s" , cc ); @@ -214,7 +213,6 @@ namespace mongo { } void _init(){ ss.str(""); - ss.write( _dummy , 20 ); } public: static Logstream& get() { |