]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
gceph,ceph: replace cerr->derr
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 16 Dec 2010 22:57:35 +0000 (14:57 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 16 Dec 2010 22:57:35 +0000 (14:57 -0800)
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/tools/ceph.cc
src/tools/common.cc
src/tools/gceph.cc
src/tools/gui.cc

index 6236fb92a3abf91ecff3041062f6acde639b3abf..a6cbbb2f21866febccd3143018a8e4fd184ab00c 100644 (file)
 #include <sys/types.h>
 #include <vector>
 
-using std::cerr;
 using std::vector;
 
 static void usage()
 {
-  cerr << "usage: ceph [options] [commands]" << std::endl;
-  cerr << "If no commands are specified, enter interactive mode.\n";
-  cerr << "Commands:" << std::endl;
-  cerr << "   stop              -- cleanly shut down file system" << std::endl
-       << "   (osd|pg|mds) stat -- get monitor subsystem status" << std::endl
-       << "   ..." << std::endl;
-  cerr << "Options:" << std::endl;
-  cerr << "   -i infile\n";
-  cerr << "   -o outfile\n";
-  cerr << "        specify input or output file (for certain commands)\n";
-  cerr << "   -s or --status\n";
-  cerr << "        print current system status\n";
-  cerr << "   -w or --watch\n";
-  cerr << "        watch system status changes in real time (push)\n";
+  derr << "usage: ceph [options] [commands]" << dendl;
+  derr << "If no commands are specified, enter interactive mode." << dendl;
+  derr << "Commands:" << dendl;
+  derr << "   stop              -- cleanly shut down file system\n"
+       << "   (osd|pg|mds) stat -- get monitor subsystem status\n"
+       << "   ..." << dendl;
+  derr << "Options:" << dendl;
+  derr << "   -i infile\n"
+       << "   -o outfile\n"
+       << "        specify input or output file (for certain commands)\n"
+       << "   -s or --status\n"
+       << "        print current system status\n"
+       << "   -w or --watch\n"
+       << "        watch system status changes in real time (push)" << dendl;
   generic_client_usage(); // Will exit()
 }
 
@@ -65,7 +64,7 @@ static void parse_cmd_args(const vector<const char*> &args,
     } else if (CONF_ARG_EQ("help", 'h')) {
       usage();
     } else if (args[i][0] == '-' && nargs->empty()) {
-      cerr << "unrecognized option " << args[i] << std::endl;
+      derr << "unrecognized option " << args[i] << dendl;
       usage();
     } else {
       nargs->push_back(args[i]);
@@ -98,15 +97,15 @@ static int get_indata(const char *in_file, bufferlist &indata)
   int fd = TEMP_FAILURE_RETRY(::open(in_file, O_RDONLY));
   if (fd < 0) {
     int err = errno;
-    cerr << "error opening in_file '" << in_file << "': "
-        << cpp_strerror(err);
+    derr << "error opening in_file '" << in_file << "': "
+        << cpp_strerror(err) << dendl;
     return 1;
   }
   struct stat st;
   if (::fstat(fd, &st)) {
     int err = errno;
-    cerr << "error getting size of in_file '" << in_file << "': "
-        << cpp_strerror(err);
+    derr << "error getting size of in_file '" << in_file << "': "
+        << cpp_strerror(err) << dendl;
     return 1;
   }
 
@@ -114,13 +113,13 @@ static int get_indata(const char *in_file, bufferlist &indata)
   indata.zero();
   int ret = safe_read(fd, indata.c_str(), st.st_size);
   if (ret) {
-    cerr << "error reading in_file '" << in_file << "': "
-        << cpp_strerror(ret);
+    derr << "error reading in_file '" << in_file << "': "
+        << cpp_strerror(ret) << dendl;
     return 1;
   }
 
   TEMP_FAILURE_RETRY(::close(fd));
-  cout << "read " << st.st_size << " bytes from " << in_file << std::endl;
+  derr << "read " << st.st_size << " bytes from " << in_file << dendl;
   return 0;
 }
 
@@ -149,13 +148,13 @@ int main(int argc, const char **argv)
 
   if (in_file) {
     if (get_indata(in_file, indata)) {
-      cerr << "failed to get data from '" << in_file << "'" << std::endl;
+      derr << "failed to get data from '" << in_file << "'" << dendl;
       return 1;
     }
   }
 
   if (ceph_tool_common_init(mode)) {
-    cerr << "ceph_tool_common_init failed." << std::endl;
+    derr << "ceph_tool_common_init failed." << dendl;
     return 1;
   }
 
@@ -188,7 +187,7 @@ int main(int argc, const char **argv)
     }
 
     default: {
-      cerr << "logic error: illegal ceph command mode " << mode << std::endl;
+      derr << "logic error: illegal ceph command mode " << mode << dendl;
       ret = 1;
       break;
     }
index daf065d1b56241764089b8b5852a7341b71fad90..0a867a85d509887fccca30882b7ab24ae3b77c21 100644 (file)
@@ -511,7 +511,8 @@ int ceph_tool_cli_input(std::vector<std::string> &cmd, const char *outfile,
 
   if (!outfile) {
     // error: no output specified
-    cout << g_clock.now() << " got " << len << " byte payload, discarding (specify -o <outfile)" << std::endl;
+    derr << " got " << len << " byte payload, discarding "
+         << "(specify -o <outfile)" << dendl;
     return 1;
   }
   if (strcmp(outfile, "-") == 0) {
@@ -522,8 +523,8 @@ int ceph_tool_cli_input(std::vector<std::string> &cmd, const char *outfile,
 
   // write to file
   odata.write_file(outfile);
-  cout << g_clock.now() << " wrote " << len << " byte payload to "
-       << outfile << std::endl;
+  derr << " wrote " << len << " byte payload to "
+       << outfile << dendl;
   return 0;
 }
 
@@ -552,11 +553,11 @@ int ceph_tool_common_init(ceph_tool_mode_t mode)
   g.mc.init();
 
   if (g.mc.authenticate() < 0) {
-    cerr << "unable to authenticate as " << *g_conf.entity_name << std::endl;
+    derr << "unable to authenticate as " << *g_conf.entity_name << dendl;
     return 1;
   }
   if (g.mc.get_monmap() < 0) {
-    cerr << "unable to get monmap" << std::endl;
+    derr << "unable to get monmap" << dendl;
     return 1;
   }
   return 0;
index 6cc42061126e43c494d7719a653436b7f649be02..d7ab5e72968fbc8532185c9dd9102f9731905e4e 100644 (file)
 // tool/gui.cc
 int run_gui(int argc, char **argv);
 
-using std::cerr;
 using std::vector;
 
 static std::ostringstream gss;
 
 static void usage()
 {
-  cerr << "usage: gceph [options]" << std::endl;
-  cerr << std::endl;
-  cerr << "Runs the ceph graphical monitor" << std::endl;
+  derr << "usage: gceph [options]" << dendl;
+  derr << dendl;
+  derr << "Runs the ceph graphical monitor" << dendl;
   generic_client_usage(); // Will exit()
 }
 
@@ -85,7 +84,7 @@ int main(int argc, const char **argv)
   parse_gceph_args(args);
 
   if (ceph_tool_common_init(CEPH_TOOL_MODE_GUI)) {
-    cerr << "cephtool_common_init failed." << std::endl;
+    derr << "cephtool_common_init failed." << dendl;
     return 1;
   }
 
index eef4666c74bc40cacff9bb0a2b1a090dd368e0fb..33418aa9dfb33cb691b2f9973a21972ffe37028c 100644 (file)
@@ -265,12 +265,12 @@ bool GuiMonitor::open_icon(Glib::RefPtr<Gdk::Pixbuf> &icon, const std::string &p
       icon = Gdk::Pixbuf::create_from_file(path);
   }
   catch (const Gdk::PixbufError& e) {
-      cerr << "Problem making graphic from " << path << "; error code: "
-          << e.code() << ": " << e.what() << std::endl;
+      derr << "Problem making graphic from " << path << "; error code: "
+          << e.code() << ": " << e.what() << dendl;
       return false;
   }
   catch (const Glib::FileError& e) {
-      cerr << "Problem open " << path << std::endl;
+      derr << "Problem open " << path << dendl;
       return false;
   }
 
@@ -1751,7 +1751,7 @@ int run_gui(int argc, char **argv)
 
   ret = calculate_resource_path_prefix(argv[0]);
   if (ret) {
-    cerr << "Couldn't find GUI resource files!" << std::endl;
+    derr << "Couldn't find GUI resource files!" << dendl;
     goto done;
   }
 
@@ -1771,7 +1771,7 @@ int run_gui(int argc, char **argv)
     gui = new GuiMonitor(builder);
 
     if (!gui->init()) {
-      cerr << "There was a problem with initializing the GUI." << std::endl;
+      derr << "There was a problem with initializing the GUI." << dendl;
       ret = EXIT_FAILURE;
       goto done;
     }
@@ -1781,22 +1781,22 @@ int run_gui(int argc, char **argv)
     gui->run_main_loop(kit);
   }
   catch(const Gtk::BuilderError& ex) {
-    std::cerr << "Gtk BuilderError: " << ex.what() << std::endl;
+    derr << "Gtk BuilderError: " << ex.what() << dendl;
     ret = EXIT_FAILURE;
     goto done;
   }
   catch(const Glib::FileError& ex) {
-    std::cerr << "FileError: " << ex.what() << std::endl;
+    derr << "FileError: " << ex.what() << dendl;
     ret = EXIT_FAILURE;
     goto done;
   }
   catch (const Glib::Exception &e) {
-    cerr << "got Glib exception: " << e.what() << std::endl;
+    derr << "got Glib exception: " << e.what() << dendl;
     ret = EXIT_FAILURE;
     goto done;
   }
   catch (const std::exception &e) {
-    cerr << "got exception: " << e.what() << std::endl;
+    derr << "got exception: " << e.what() << dendl;
     ret = EXIT_FAILURE;
     goto done;
   }