Skip to content

Commit c2221e1

Browse files
committed
Additional verbose logging
1 parent d00eedb commit c2221e1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/web_video_server.cpp

Lines changed: 16 additions & 1 deletion
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();
@@ -148,6 +156,9 @@ void WebVideoServer::cleanup_inactive_streams()
148156
}
149157
}
150158
image_subscribers_.erase(new_end, image_subscribers_.end());
159+
if(__verbose) {
160+
ROS_INFO_STREAM("cleanup streams: " << " now serving " << image_subscribers_.size());
161+
}
151162
}
152163
}
153164

@@ -184,6 +195,10 @@ bool WebVideoServer::handle_stream(const async_web_server_cpp::HttpRequest &requ
184195
streamer->start();
185196
boost::mutex::scoped_lock lock(subscriber_mutex_);
186197
image_subscribers_.push_back(streamer);
198+
if (__verbose)
199+
{
200+
ROS_INFO_STREAM("Serving " << image_subscribers_.size() << " streams");
201+
}
187202
}
188203
else
189204
{

0 commit comments

Comments
 (0)