summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-01-15 11:26:38 -0500
committerAaron <aaron@10gen.com>2009-01-15 11:26:38 -0500
commit261a467aa50cf6c733c89d2e299a8dd63b569750 (patch)
treeb6188ac5f04e08940762b2f9bdbf7fcd02caac24 /tools
parent90d45238aa5fccb6dbdf0b40dfcf5823695d4643 (diff)
downloadmongo-261a467aa50cf6c733c89d2e299a8dd63b569750.tar.gz
Replaced our #defined cout with mongo::out()
Diffstat (limited to 'tools')
-rw-r--r--tools/dump.cpp18
-rw-r--r--tools/import.cpp18
2 files changed, 18 insertions, 18 deletions
diff --git a/tools/dump.cpp b/tools/dump.cpp
index 63784831c01..a8b4e1fb139 100644
--- a/tools/dump.cpp
+++ b/tools/dump.cpp
@@ -28,7 +28,7 @@ namespace mongo {
namespace dump {
void doCollection( DBClientConnection & conn , const char * coll , path outputFile ) {
- cout << "\t" << coll << " to " << outputFile.string() << endl;
+ mongo::out() << "\t" << coll << " to " << outputFile.string() << endl;
int out = open( outputFile.string().c_str() , O_WRONLY | O_CREAT | O_TRUNC , 0666 );
assert( out );
@@ -43,13 +43,13 @@ namespace mongo {
num++;
}
- cout << "\t\t " << num << " objects" << endl;
+ mongo::out() << "\t\t " << num << " objects" << endl;
close( out );
}
void go( DBClientConnection & conn , const char * db , const path outdir ) {
- cout << "DATABASE: " << db << endl;
+ mongo::out() << "DATABASE: " << db << endl;
create_directories( outdir );
@@ -76,14 +76,14 @@ namespace mongo {
DBClientConnection conn;
string errmsg;
if ( ! conn.connect( host , errmsg ) ) {
- cout << "couldn't connect : " << errmsg << endl;
+ mongo::out() << "couldn't connect : " << errmsg << endl;
throw -11;
}
path root(outdir);
if ( strlen( db ) == 1 && db[0] == '*' ) {
- cout << "all dbs" << endl;
+ mongo::out() << "all dbs" << endl;
BSONObjBuilder query;
query.appendBool( "listDatabases" , 1 );
@@ -148,10 +148,10 @@ int main( int argc , char ** argv ) {
if ( vm.count( "out" ) )
outdir = vm["out"].as<string>().c_str();
- cout << "mongo dump" << endl;
- cout << "\t host \t" << host << endl;
- cout << "\t db \t" << db << endl;
- cout << "\t output dir \t" << outdir << endl;
+ mongo::out() << "mongo dump" << endl;
+ mongo::out() << "\t host \t" << host << endl;
+ mongo::out() << "\t db \t" << db << endl;
+ mongo::out() << "\t output dir \t" << outdir << endl;
dump::go( host , db , outdir );
}
diff --git a/tools/import.cpp b/tools/import.cpp
index ce0548fe8c5..3e11c101b2f 100644
--- a/tools/import.cpp
+++ b/tools/import.cpp
@@ -50,7 +50,7 @@ namespace mongo {
}
- cout << root.string() << endl;
+ out() << root.string() << endl;
string ns;
{
@@ -67,7 +67,7 @@ namespace mongo {
ns += "." + l;
}
- cout << "\t going into namespace [" << ns << "]" << endl;
+ out() << "\t going into namespace [" << ns << "]" << endl;
MemoryMappedFile mmf;
assert( mmf.map( root.string().c_str() ) );
@@ -79,7 +79,7 @@ namespace mongo {
while ( read < mmf.length() ) {
if ( ! *data ) {
- cout << "\t ** got unexpected end of file ** continuing..." << endl;
+ out() << "\t ** got unexpected end of file ** continuing..." << endl;
break;
}
@@ -91,10 +91,10 @@ namespace mongo {
data += o.objsize();
if ( ! ( ++num % 1000 ) )
- cout << "read " << read << "/" << mmf.length() << " bytes so far. " << num << " objects" << endl;
+ out() << "read " << read << "/" << mmf.length() << " bytes so far. " << num << " objects" << endl;
}
- cout << "\t " << num << " objects" << endl;
+ out() << "\t " << num << " objects" << endl;
}
@@ -103,7 +103,7 @@ namespace mongo {
DBClientConnection conn;
string errmsg;
if ( ! conn.connect( dbHost , errmsg ) ) {
- cout << "couldn't connect : " << errmsg << endl;
+ out() << "couldn't connect : " << errmsg << endl;
throw -11;
}
@@ -150,9 +150,9 @@ int main( int argc , char ** argv ) {
if ( vm.count( "dir" ) )
dir = vm["dir"].as<string>().c_str();
- cout << "mongo dump" << endl;
- cout << "\t host \t" << host << endl;
- cout << "\t dir \t" << dir << endl;
+ out() << "mongo dump" << endl;
+ out() << "\t host \t" << host << endl;
+ out() << "\t dir \t" << dir << endl;
import::go( host , dir );
return 0;