Slightly more detailed logging in server.
authorCarl Hetherington <cth@carlh.net>
Thu, 25 Oct 2012 17:12:04 +0000 (18:12 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 25 Oct 2012 17:12:04 +0000 (18:12 +0100)
src/lib/server.cc

index c80527567cbdd58a7c13a55a5e6f0805c37e67d6..0bf42bcb9f4fb8c8b58575ce2a809097d8040c26 100644 (file)
@@ -40,7 +40,6 @@ using std::string;
 using std::stringstream;
 using std::multimap;
 using std::vector;
-using std::cerr;
 using boost::shared_ptr;
 using boost::algorithm::is_any_of;
 using boost::algorithm::split;
@@ -131,7 +130,15 @@ Server::process (shared_ptr<Socket> socket)
                );
        
        shared_ptr<EncodedData> encoded = dcp_video_frame.encode_locally ();
-       encoded->send (socket);
+       try {
+               encoded->send (socket);
+       } catch (std::exception& e) {
+               _log->log (String::compose (
+                                  "Send failed; pixel format %1, size %2x%3, %4 components",
+                                  image->pixel_format(), image->size().width, image->size().height, image->components()
+                                  )
+                       );
+       }
 
        return frame;
 }
@@ -158,7 +165,7 @@ Server::worker_thread ()
                try {
                        frame = process (socket);
                } catch (std::exception& e) {
-                       cerr << "Error: " << e.what() << "\n";
+                       _log->log (String::compose ("Error: %1", e.what()));
                }
                
                socket.reset ();