shmmonitor: add severity setting

This commit is contained in:
Alexey Rybalchenko 2021-04-14 11:31:56 +02:00
parent 2c89b24857
commit b67b80e0ad
3 changed files with 7 additions and 3 deletions

View File

@ -238,7 +238,7 @@ class Manager
}
if (!p.empty()) {
boost::process::spawn(p, "-x", "-m", "--shmid", id, "-d", "-t", "2000", verbose ? "--verbose" : "", env);
boost::process::spawn(p, "-x", "-m", "--shmid", id, "-d", "-t", "2000", (verbose ? "--verbose" : ""), env);
int numTries = 0;
do {
try {

View File

@ -497,7 +497,7 @@ std::pair<std::string, bool> RunRemoval(std::function<bool(const std::string&)>
return {name, true};
} else {
if (verbose) {
LOG(info) << "Did not remove '" << name << "'. Already removed?";
LOG(debug) << "Did not remove '" << name << "'. Already removed?";
}
return {name, false};
}
@ -525,7 +525,7 @@ std::vector<std::pair<std::string, bool>> Monitor::Cleanup(const ShmId& shmId, b
RegionCounter* rc = managementSegment.find<RegionCounter>(bipc::unique_instance).first;
if (rc) {
if (verbose) {
LOG(info) << "Region counter found: " << rc->fCount;
LOG(debug) << "Region counter found: " << rc->fCount;
}
uint16_t regionCount = rc->fCount;

View File

@ -89,6 +89,7 @@ int main(int argc, char** argv)
bool listAll = false;
string listAllPath;
bool verbose = false;
string severity;
int userId = -1;
options_description desc("Options");
@ -109,6 +110,7 @@ int main(int argc, char** argv)
("list-all" , value<bool>(&listAll)->implicit_value(true), "List all sessions & segments")
("list-all-path" , value<string>(&listAllPath)->default_value("/dev/shm/"),"Path for the --list-all command to search segments in")
("verbose" , value<bool>(&verbose)->implicit_value(true), "Verbose mode (daemon will output to a file 'fairmq-shmmonitor_<timestamp>')")
("severity" , value<string>(&severity)->default_value("info"), "Log severity")
("user-id" , value<int>(&userId)->default_value(-1), "User id (used with --get-shmid)")
("help,h", "Print help");
@ -122,6 +124,8 @@ int main(int argc, char** argv)
notify(vm);
fair::Logger::SetConsoleSeverity(severity);
if (getShmId) {
if (userId == -1) {
LOG(info) << "shmem id for session '" << sessionName << "' and current user id " << geteuid()