diff options
author | Aaron <aaron@10gen.com> | 2009-02-04 13:09:00 -0500 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2009-02-04 13:09:00 -0500 |
commit | 83915a68783c30d7054ece53f8b67340da01278a (patch) | |
tree | 4365927d81e5beb58068a91792e44bf0cbc490da /stdafx.cpp | |
parent | 57dc491b4b6447e24e41d60f75516e4b443d2363 (diff) | |
download | mongo-83915a68783c30d7054ece53f8b67340da01278a.tar.gz |
Add timestamp to lockless output function
Diffstat (limited to 'stdafx.cpp')
-rw-r--r-- | stdafx.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/stdafx.cpp b/stdafx.cpp index ade2d6281ef..b4f90f7162a 100644 --- a/stdafx.cpp +++ b/stdafx.cpp @@ -106,5 +106,19 @@ namespace mongo { dbexit( status ); } + void rawOut( const string &s ) { + char now[64]; + time_t_to_String(time(0), now); + now[20] = 0; +#if defined(_WIN32) + (std::cout << now << " " << s).flush(); +#else + write( STDOUT_FILENO, now, 20 ); + write( STDOUT_FILENO, " ", 1 ); + write( STDOUT_FILENO, s.c_str(), s.length() ); + fsync( STDOUT_FILENO ); +#endif + } + } // namespace mongo |