#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()
}
} 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]);
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;
}
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;
}
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;
}
}
default: {
- cerr << "logic error: illegal ceph command mode " << mode << std::endl;
+ derr << "logic error: illegal ceph command mode " << mode << dendl;
ret = 1;
break;
}
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) {
// 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;
}
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;
// 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()
}
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;
}
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;
}
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;
}
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;
}
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;
}