Skip to content

Commit b95ba79

Browse files
committed
Additional verbose logging
1 parent d00eedb commit b95ba79

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/web_video_server.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ static bool ros_connection_logger(async_web_server_cpp::HttpServerRequestHandler
3333
try
3434
{
3535
forward(request, connection, begin, end);
36+
if (__verbose)
37+
{
38+
ROS_INFO_STREAM("Request forwarded: " << request.uri);
39+
}
40+
3641
return true;
3742
}
3843
catch (std::exception &e)
@@ -64,6 +69,9 @@ WebVideoServer::WebVideoServer(ros::NodeHandle &nh, ros::NodeHandle &private_nh)
6469
private_nh.param("ros_threads", ros_threads_, 2);
6570
private_nh.param("publish_rate", publish_rate_, -1.0);
6671

72+
if(__verbose) {
73+
ROS_INFO_STREAM("Starting with args server threads: " << server_threads << " ros_threads: " << ros_threads_);
74+
}
6775
private_nh.param<std::string>("default_stream_type", __default_stream_type, "mjpeg");
6876

6977
stream_types_["mjpeg"] = boost::shared_ptr<ImageStreamerType>(new MjpegStreamerType());
@@ -101,7 +109,7 @@ WebVideoServer::~WebVideoServer()
101109
void WebVideoServer::spin()
102110
{
103111
server_->run();
104-
ROS_INFO_STREAM("Waiting For connections on " << address_ << ":" << port_);
112+
ROS_INFO_STREAM("Waiting For connections on " << address_ << ":" << port_);
105113

106114
ros::AsyncSpinner spinner(ros_threads_);
107115
spinner.start();
@@ -144,7 +152,7 @@ void WebVideoServer::cleanup_inactive_streams()
144152
{
145153
for (itr_type itr = new_end; itr < image_subscribers_.end(); ++itr)
146154
{
147-
ROS_INFO_STREAM("Removed Stream: " << (*itr)->getTopic());
155+
ROS_INFO_STREAM("Removed Stream: " << (*itr)->getTopic() << " now serving " << image_subscribers_.size());
148156
}
149157
}
150158
image_subscribers_.erase(new_end, image_subscribers_.end());
@@ -184,6 +192,10 @@ bool WebVideoServer::handle_stream(const async_web_server_cpp::HttpRequest &requ
184192
streamer->start();
185193
boost::mutex::scoped_lock lock(subscriber_mutex_);
186194
image_subscribers_.push_back(streamer);
195+
if (__verbose)
196+
{
197+
ROS_INFO_STREAM("Serving " << image_subscribers_.size() << " streams");
198+
}
187199
}
188200
else
189201
{

0 commit comments

Comments
 (0)