diff options
author | Dwight <dmerriman@gmail.com> | 2008-07-09 12:32:11 -0400 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-07-09 12:32:11 -0400 |
commit | ee68a8e252224d3d771bc08c17078fb50e12d885 (patch) | |
tree | 8c9f14592b8dfd278ca03a7303f6b16baaa0665d /util | |
parent | 1bf45a0843ae3f28977f3a26a637c478ac557371 (diff) | |
download | mongo-ee68a8e252224d3d771bc08c17078fb50e12d885.tar.gz |
--nocursors
Diffstat (limited to 'util')
-rw-r--r-- | util/log.h | 37 | ||||
-rw-r--r-- | util/mmap.cpp | 7 | ||||
-rw-r--r-- | util/util.cpp | 2 |
3 files changed, 44 insertions, 2 deletions
diff --git a/util/log.h b/util/log.h new file mode 100644 index 00000000000..90e7141706c --- /dev/null +++ b/util/log.h @@ -0,0 +1,37 @@ +// log.h
+
+#pragma once
+
+class Nullstream {
+public:
+ Nullstream& operator<<(const char *) { return *this; }
+ Nullstream& operator<<(int) { return *this; }
+ Nullstream& operator<<(unsigned long) { return *this; }
+ Nullstream& operator<<(unsigned) { return *this; }
+ Nullstream& operator<<(double) { return *this; }
+ Nullstream& operator<<(void *) { return *this; }
+ Nullstream& operator<<(long long) { return *this; }
+ Nullstream& operator<<(unsigned long long) { return *this; }
+ Nullstream& operator<<(const string&) { return *this; }
+ Nullstream& operator<< (ostream& ( *endl )(ostream&)) { return *this; }
+ Nullstream& operator<< (ios_base& (*hex)(ios_base&)) { return *this; }
+};
+
+inline Nullstream& endl ( Nullstream& os ) { }
+
+extern Nullstream nullstream;
+
+//#define cout nullstream
+
+// not threadsafe +inline ostream& problem() { + ostream& problems = cout; + time_t t; + time(&t); + string now(ctime(&t),0,20); + problems << "~ " << now; + if( client ) + problems << curNs << ' '; + return problems; +} + diff --git a/util/mmap.cpp b/util/mmap.cpp index ab814f61f80..e29dcc6b6f3 100644 --- a/util/mmap.cpp +++ b/util/mmap.cpp @@ -80,8 +80,11 @@ void* MemoryMappedFile::map(const char *filename, int length) { } view = MapViewOfFile(maphandle, FILE_MAP_ALL_ACCESS, 0, 0, 0); - if( view == 0 ) - cout << "MapViewOfFile failed " << filename << " errno:" << GetLastError() << endl; + if( view == 0 ) { + cout << "MapViewOfFile failed " << filename << " errno:"; + cout << GetLastError(); + cout << endl; + } return view; } diff --git a/util/util.cpp b/util/util.cpp index 92e0edb7423..ddb96921ef5 100644 --- a/util/util.cpp +++ b/util/util.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "goodies.h" +Nullstream nullstream; + unsigned occasion = 0; bool goingAway = false; |