Skip to content

Commit

Permalink
PXC-3423: Introduce a garbd variable to enable logging of debugging
Browse files Browse the repository at this point in the history
          information to the error log

https://jira.percona.com/browse/PXC-3423

This patch introduces "--debug" variable to garbd to enable logging of
debugging information in garbd.
  • Loading branch information
venkatesh-prasad-v committed Feb 6, 2023
1 parent b7d20c2 commit 8c03864
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions garb/garb_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ Config::Config (int argc, char* argv[])
cfg_ (),
recv_script_ (),
workdir_ (),
debug_ (false),
exit_ (false)
{
po::options_description other ("Other options");
other.add_options()
("version,v", "Print version & exit")
("help,h", "Show help message & exit")
("debug", "Enable debug prints")
;

// only these are read from cfg file
Expand All @@ -66,8 +68,7 @@ Config::Config (int argc, char* argv[])
("options,o", po::value<std::string>(&options_), "GCS/GCOMM option list")
("log,l", po::value<std::string>(&log_), "Log file")
("recv-script", po::value<std::string>(&recv_script_), "SST request receive script")
("workdir,w",po::value<std::string>(&workdir_),
"Daemon working directory")
("workdir,w",po::value<std::string>(&workdir_), "Daemon working directory")
;

po::options_description cfg_opt;
Expand Down Expand Up @@ -103,6 +104,12 @@ Config::Config (int argc, char* argv[])
return;
}

if (vm.count("debug"))
{
debug_ = true;
gu_conf_debug_on();
}

if (vm.count("cfg"))
{
std::ifstream ifs(cfg_.c_str());
Expand Down Expand Up @@ -201,7 +208,8 @@ std::ostream& operator << (std::ostream& os, const Config& c)
<< "\n\tcfg: " << c.cfg()
<< "\n\tlog: " << c.log()
<< "\n\trecv_script: " << c.recv_script()
<< "\n\tworkdir: " << c.workdir();
<< "\n\tworkdir: " << c.workdir()
<< "\n\tdebug: " << c.debug();;
return os;
}

Expand Down
2 changes: 2 additions & 0 deletions garb/garb_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Config
const std::string& log() const { return log_ ; }
const std::string& workdir() const { return workdir_; }
bool exit() const { return exit_ ; }
bool debug() const { return debug_ ; }
const std::string& recv_script() const { return recv_script_ ; }

private:
Expand All @@ -44,6 +45,7 @@ class Config
std::string cfg_;
std::string recv_script_;
std::string workdir_;
bool debug_;
bool exit_; /* Exit on --help or --version */

}; /* class Config */
Expand Down

0 comments on commit 8c03864

Please sign in to comment.