Skip to content

Commit

Permalink
Migrate igndbg -> gzdbg
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <methylDragon@gmail.com>
  • Loading branch information
methylDragon committed May 25, 2022
1 parent 08d9cf9 commit 91282c4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion plugins/gazebo_factory/GazeboFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ bool GazeboFactory::Load(const tinyxml2::XMLElement *_elem)

if (executed && result && rep.data())
{
igndbg << "Factory service call succeeded.\n";
gzdbg << "Factory service call succeeded.\n";
if (!this->worldPerformers[msg.first].empty())
{
IGN_SLEEP_S(2);
Expand Down
2 changes: 1 addition & 1 deletion plugins/gazebo_gui/GazeboGui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ bool GazeboGui::Load(const tinyxml2::XMLElement *_elem)
app->LoadPlugin(file, elem);
}

igndbg << "Running the GazeboGui plugin.\n";
gzdbg << "Running the GazeboGui plugin.\n";
// This blocks until the window is closed or we receive a SIGINT
app->exec();

Expand Down
2 changes: 1 addition & 1 deletion plugins/gazebo_server/GazeboServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,6 @@ bool GazeboServer::Load(const tinyxml2::XMLElement *_elem)
this->server.reset(new sim::Server(serverConfig));
this->server->Run(false, 0, !run);

igndbg << "Loaded GazeboServer plugin.\n";
gzdbg << "Loaded GazeboServer plugin.\n";
return true;
}
2 changes: 1 addition & 1 deletion plugins/joy_to_twist/JoyToTwist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool JoyToTwist::Load(const tinyxml2::XMLElement *_elem)
this->cmdVelPub = this->node.Advertise<gz::msgs::Twist>(
this->outputTopic);

igndbg << "Loaded JoyToTwist plugin with the following parameters:\n"
gzdbg << "Loaded JoyToTwist plugin with the following parameters:\n"
<< " input_topic: " << this->inputTopic << std::endl
<< " output_topic: " << this->outputTopic << std::endl;
this->running = true;
Expand Down
2 changes: 1 addition & 1 deletion plugins/joystick/Joystick.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ bool Joystick::Load(const tinyxml2::XMLElement *_elem)
this->run = true;
this->joyThread = new std::thread(std::bind(&Joystick::Run, this));

igndbg << "Loaded Joystick plugin with the following parameters:\n"
gzdbg << "Loaded Joystick plugin with the following parameters:\n"
<< " device: " << deviceFilename << std::endl
<< " sticky_buttons: " << this->stickyButtons << std::endl
<< " dead_zone: " << deadzone << std::endl
Expand Down
50 changes: 25 additions & 25 deletions plugins/websocket_server/WebsocketServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ int httpCallback(struct lws *_wsi,
case LWS_CALLBACK_HTTP:
{
char *URI = (char *) _in;
igndbg << "Requested URI: " << URI << "\n";
gzdbg << "Requested URI: " << URI << "\n";

// Router
// Server metrics
if (strcmp(URI, "/metrics") == 0)
{
igndbg << "Handling /metrics\n";
gzdbg << "Handling /metrics\n";

// TODO Support a proper way to output metrics

Expand Down Expand Up @@ -188,7 +188,7 @@ int httpCallback(struct lws *_wsi,
// Return a 404 if no route was matched
else
{
igndbg << "Resource not found.\n";
gzdbg << "Resource not found.\n";
lws_return_http_status(_wsi, HTTP_STATUS_NOT_FOUND, "Not Found");
}
break;
Expand Down Expand Up @@ -232,7 +232,7 @@ int rootCallback(struct lws *_wsi,
{
// Open connections.
case LWS_CALLBACK_ESTABLISHED:
igndbg << "LWS_CALLBACK_ESTABLISHED\n";
gzdbg << "LWS_CALLBACK_ESTABLISHED\n";
self->OnConnect(fd);
// This will generate a LWS_CALLBACK_SERVER_WRITEABLE event when the
// connection is writable.
Expand All @@ -241,12 +241,12 @@ int rootCallback(struct lws *_wsi,

// Close connections.
case LWS_CALLBACK_CLOSED:
igndbg << "LWS_CALLBACK_CLOSED\n";
gzdbg << "LWS_CALLBACK_CLOSED\n";
self->OnDisconnect(fd);
break;

case LWS_CALLBACK_HTTP:
igndbg << "LWS_CALLBACK_HTTP\n";
gzdbg << "LWS_CALLBACK_HTTP\n";
return httpCallback(_wsi, _reason, _user, _in, _len);
break;

Expand Down Expand Up @@ -286,7 +286,7 @@ int rootCallback(struct lws *_wsi,

// Handle incoming messages
case LWS_CALLBACK_RECEIVE:
igndbg << "LWS_CALLBACK_RECEIVE\n";
gzdbg << "LWS_CALLBACK_RECEIVE\n";

// Prevent too many connections.
if (self->maxConnections >= 0 &&
Expand Down Expand Up @@ -398,7 +398,7 @@ bool WebsocketServer::Load(const tinyxml2::XMLElement *_elem)
<< std::endl;
}
}
igndbg << "Using port[" << port << "]\n";
gzdbg << "Using port[" << port << "]\n";

// Get the maximum connection count, if present.
elem = _elem->FirstChildElement("max_connections");
Expand All @@ -413,7 +413,7 @@ bool WebsocketServer::Load(const tinyxml2::XMLElement *_elem)
gzerr << "Failed to convert max_connections[" << elem->GetText()
<< "] to integer." << std::endl;
}
igndbg << "Using maximum connection count of "
gzdbg << "Using maximum connection count of "
<< this->maxConnections << std::endl;
}

Expand All @@ -432,7 +432,7 @@ bool WebsocketServer::Load(const tinyxml2::XMLElement *_elem)
gzerr << "Failed to parse queue_size_per_connection["
<< elem->GetText() << "]." << std::endl;
}
igndbg << "Using connection msg queue size of "
gzdbg << "Using connection msg queue size of "
<< this->queueSizePerConnection << std::endl;
}

Expand All @@ -453,7 +453,7 @@ bool WebsocketServer::Load(const tinyxml2::XMLElement *_elem)
if (result == tinyxml2::XML_SUCCESS && limit >= 0)
{
this->msgTypeSubscriptionLimit[msgType] = limit;
igndbg << "Setting msg type subscription limit[" << msgType
gzdbg << "Setting msg type subscription limit[" << msgType
<< ", " << limit << "]" << std::endl;
}
else
Expand Down Expand Up @@ -694,7 +694,7 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
key == this->adminAuthorizationKey;
}

igndbg << "Authorization request received on socket[" << _socketId << "]. "
gzdbg << "Authorization request received on socket[" << _socketId << "]. "
<< "Authorized[" << this->connections[_socketId]->authorized << "]\n";

std::string result =
Expand All @@ -706,14 +706,14 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)

if (!this->connections[_socketId]->authorized)
{
igndbg << "Unauthorized request received on socket[" << _socketId << "]\n";
gzdbg << "Unauthorized request received on socket[" << _socketId << "]\n";
return;
}

// Handle the case where the client requests the message definitions.
if (frameParts[0] == "protos")
{
igndbg << "Protos request received\n";
gzdbg << "Protos request received\n";

std::string allProtos = "syntax = \"proto3\";\n";
allProtos += "package gz.msgs;\n";
Expand Down Expand Up @@ -747,7 +747,7 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
}
else if (frameParts[0] == "topics")
{
igndbg << "Topic list request recieved\n";
gzdbg << "Topic list request recieved\n";
gz::msgs::StringMsg_V msg;

std::vector<std::string> topics;
Expand All @@ -768,7 +768,7 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
}
else if (frameParts[0] == "topics-types")
{
igndbg << "Topic and message type list request recieved\n";
gzdbg << "Topic and message type list request recieved\n";
gz::msgs::Publishers msg;

std::vector<std::string> topics;
Expand Down Expand Up @@ -798,7 +798,7 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
}
else if (frameParts[0] == "worlds")
{
igndbg << "World info request recieved\n";
gzdbg << "World info request recieved\n";
gz::msgs::Empty req;
req.set_unused(true);

Expand All @@ -818,7 +818,7 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
}
else if (frameParts[0] == "scene")
{
igndbg << "Scene info request recieved for world["
gzdbg << "Scene info request recieved for world["
<< frameParts[1] << "]\n";
gz::msgs::Empty req;
req.set_unused(true);
Expand Down Expand Up @@ -848,7 +848,7 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
/// to rely on the "scene" message.
else if (frameParts[0] == "particle_emitters")
{
igndbg << "Particle emitter request received for world["
gzdbg << "Particle emitter request received for world["
<< frameParts[1] << "]\n";
gz::msgs::Empty req;
req.set_unused(true);
Expand Down Expand Up @@ -888,7 +888,7 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
this->topicTimestamps[topic] =
std::chrono::steady_clock::now() - this->publishPeriod;

igndbg << "Subscribe request to topic[" << frameParts[1] << "]\n";
gzdbg << "Subscribe request to topic[" << frameParts[1] << "]\n";
this->node.SubscribeRaw(topic,
std::bind(&WebsocketServer::OnWebsocketSubscribedMessage,
this, std::placeholders::_1,
Expand Down Expand Up @@ -926,20 +926,20 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)

if (!imageTopics.count(topic))
{
igndbg << "Could not find topic: " << topic << " to stream"
gzdbg << "Could not find topic: " << topic << " to stream"
<< std::endl;
return;
}

igndbg << "Subscribe request to image topic[" << frameParts[1] << "]\n";
gzdbg << "Subscribe request to image topic[" << frameParts[1] << "]\n";
this->node.Subscribe(frameParts[1],
&WebsocketServer::OnWebsocketSubscribedImageMessage, this);
}
else if (frameParts[0] == "unsub")
{
std::string topic = frameParts[1];

igndbg << "Unsubscribe request for topic[" << topic << "]\n";
gzdbg << "Unsubscribe request for topic[" << topic << "]\n";
std::map<std::string, std::set<int>>::iterator topicConnectionIter =
this->topicConnections.find(topic);

Expand All @@ -960,7 +960,7 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
// more websocket connections.
if (topicConnectionIter->second.empty())
{
igndbg << "Unsubscribing from Gazebo Transport Topic["
gzdbg << "Unsubscribing from Gazebo Transport Topic["
<< frameParts[1] << "]\n";
this->node.Unsubscribe(frameParts[1]);
}
Expand All @@ -974,7 +974,7 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
else if (frameParts[0] == "throttle")
{
std::string topic = frameParts[1];
igndbg << "Throttle request for topic[" << topic << "]\n";
gzdbg << "Throttle request for topic[" << topic << "]\n";
if (!topic.empty())
{
try
Expand Down
24 changes: 12 additions & 12 deletions src/Manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ bool ManagerPrivate::Stop()
/////////////////////////////////////////////////
void ManagerPrivate::OnSigIntTerm(int _sig)
{
igndbg << "OnSigIntTerm Received signal[" << _sig << "]\n";
gzdbg << "OnSigIntTerm Received signal[" << _sig << "]\n";
this->Stop();
}

Expand Down Expand Up @@ -578,7 +578,7 @@ void ManagerPrivate::RestartLoop()
{
if (iter->pid == p)
{
igndbg << "Death of process[" << p << "] with name["
gzdbg << "Death of process[" << p << "] with name["
<< iter->name << "].\n";

// Restart if autoRestart is enabled
Expand All @@ -592,7 +592,7 @@ void ManagerPrivate::RestartLoop()

if (!restartExec.name.empty() && !restartExec.command.empty())
{
igndbg << "Restarting process with name[" << restartExec.name << "]\n";
gzdbg << "Restarting process with name[" << restartExec.name << "]\n";
this->RunExecutable(restartExec);
}

Expand Down Expand Up @@ -639,7 +639,7 @@ void ManagerPrivate::RestartLoop()
{
if (iter->pi == p)
{
igndbg << "Death of process[" << p << "] with name ["
gzdbg << "Death of process[" << p << "] with name ["
<< iter->name << "].\n";

// Restart if autoRestart is enabled
Expand All @@ -653,7 +653,7 @@ void ManagerPrivate::RestartLoop()

if (!restartExec.name.empty() && !restartExec.command.empty())
{
igndbg << "Restarting process with name[" << restartExec.name << "]\n";
gzdbg << "Restarting process with name[" << restartExec.name << "]\n";
this->RunExecutable(restartExec);
}

Expand Down Expand Up @@ -815,7 +815,7 @@ bool ManagerPrivate::RunExecutable(const std::string &_name,
// If parent process...
if (pid)
{
igndbg << "Forked a process for [" << _name << "] command["
gzdbg << "Forked a process for [" << _name << "] command["
<< std::accumulate(_cmd.begin(), _cmd.end(), std::string("")) << "]\n"
<< std::flush;

Expand Down Expand Up @@ -909,7 +909,7 @@ void ManagerPrivate::ShutdownExecutables()
// Shutdown the processes
for (const Executable &exec : this->executables)
{
igndbg << "Killing the process[" << exec.name
gzdbg << "Killing the process[" << exec.name
#ifndef _WIN32
<< "] with PID[" << exec.pid << "]\n";
kill(exec.pid, SIGINT);
Expand All @@ -926,20 +926,20 @@ void ManagerPrivate::ShutdownExecutables()
#endif
{
#ifndef _WIN32
igndbg << "Killing the wrapped plugin PID[" << pid << "]\n";
gzdbg << "Killing the wrapped plugin PID[" << pid << "]\n";
kill(pid, SIGINT);
#else
igndbg << "Killing the wrapped plugin PID[" << pid.dwProcessId << "]\n";
gzdbg << "Killing the wrapped plugin PID[" << pid.dwProcessId << "]\n";
TerminateProcess(pid.hProcess, 0);
#endif
}

igndbg << "Waiting for each process to end\n";
gzdbg << "Waiting for each process to end\n";

// Wait for all the monitors to stop
for (std::thread &m : monitors)
m.join();
igndbg << "All finished\n";
gzdbg << "All finished\n";
}

//////////////////////////////////////////////////
Expand Down Expand Up @@ -1134,7 +1134,7 @@ void ManagerPrivate::LoadPlugin(const tinyxml2::XMLElement *_elem)
return;
}

igndbg << "Loading plugin. Name[" << name
gzdbg << "Loading plugin. Name[" << name
<< "] File[" << file << "]" << std::endl;

PluginPtr plugin = loader.Instantiate(name);
Expand Down

0 comments on commit 91282c4

Please sign in to comment.