FOR_EACH_ARG(args) {
if (CONF_ARG_EQ("in_file", 'i')) {
CONF_SAFE_SET_ARG_VAL(in_file, OPT_STR);
+ } else if (CONF_ARG_EQ("concise", '\0')) {
+ g.concise = true;
} else if (CONF_ARG_EQ("out_file", 'o')) {
CONF_SAFE_SET_ARG_VAL(out_file, OPT_STR);
} else if (CONF_ARG_EQ("status", 's')) {
m->cmd = pending_cmd;
m->set_data(pending_bl);
- *g.log << g_clock.now() << " mon" << " <- " << pending_cmd << std::endl;
+ if (!g.concise)
+ *g.log << g_clock.now() << " mon" << " <- " << pending_cmd << std::endl;
g.mc.send_mon_message(m);
}
rs = rs;
rbl = reply_bl;
- *g.log << g_clock.now() << " "
- << reply_from.name << " -> '"
- << reply_rs << "' (" << reply_rc << ")"
- << std::endl;
+ if (!g.concise)
+ *g.log << g_clock.now() << " "
+ << reply_from.name << " -> '"
+ << reply_rs << "' (" << reply_rc << ")"
+ << std::endl;
+ else
+ cout << reply_rs << std::endl;
return reply_rc;
}
bufferlist in;
if (cmd.size() == 1 && cmd[0] == "print") {
- *g.log << "----" << std::endl;
+ if (!g.concise)
+ *g.log << "----" << std::endl;
fwrite(in.c_str(), in.length(), 1, stdout);
- *g.log << "---- (" << in.length() << " bytes)" << std::endl;
+ if (!g.concise)
+ *g.log << "---- (" << in.length() << " bytes)" << std::endl;
return 0;
}
bufferlist out;
if (infile) {
if (out.read_file(infile) == 0) {
- *g.log << "read " << out.length() << " from " << infile << std::endl;
+ if (!g.concise)
+ *g.log << "read " << out.length() << " from " << infile << std::endl;
} else {
char buf[80];
*g.log << "couldn't read from " << infile << ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl;
if (outfile) {
if (strcmp(outfile, "-") == 0) {
- *g.log << "----" << std::endl;
+ if (!g.concise)
+ *g.log << "----" << std::endl;
fwrite(in.c_str(), in.length(), 1, stdout);
- *g.log << "---- (" << in.length() << " bytes)" << std::endl;
+ if (!g.concise)
+ *g.log << "---- (" << in.length() << " bytes)" << std::endl;
}
else {
in.write_file(outfile);
- *g.log << "wrote " << in.length() << " to "
- << outfile << std::endl;
+ if (!g.concise)
+ *g.log << "wrote " << in.length() << " to "
+ << outfile << std::endl;
}
}
else {
- *g.log << "got " << in.length() << " byte payload; 'print' "
- << "to dump to terminal, or add '>-' to command." << std::endl;
+ if (!g.concise)
+ *g.log << "got " << in.length() << " byte payload; 'print' "
+ << "to dump to terminal, or add '>-' to command." << std::endl;
}
return 0;
}