[Spice-devel] [PATCH spice-streaming-agent 4/4] Add option to disable logging full frames

Frediano Ziglio fziglio at redhat.com
Mon Apr 23 15:07:44 UTC 2018


In some cases we want to avoid saving huge amount of data on the log.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/spice-streaming-agent.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 503c3b5..ab663cb 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -59,6 +59,7 @@ struct SpiceStreamDataMessage
 static bool streaming_requested = false;
 static bool quit_requested = false;
 static bool log_binary = false;
+static bool log_no_frames = false;
 static std::set<SpiceVideoCodecType> client_codecs;
 static int streamfd = -1;
 static std::mutex stream_mtx;
@@ -458,7 +459,7 @@ do_capture(const char *streamport, FILE *f_log)
                 }
             }
             STAT_LOG("Frame of %zu bytes:", frame.buffer_size);
-            if (f_log) {
+            if (f_log && !log_no_frames) {
                 if (log_binary) {
                     fwrite(frame.buffer, frame.buffer_size, 1, f_log);
                 } else {
@@ -498,10 +499,12 @@ int main(int argc, char* argv[])
         OPT_first = UCHAR_MAX,
         OPT_PLUGINS_DIR,
         OPT_LOG_BINARY,
+        OPT_NO_LOG_FRAMES,
     };
     static const struct option long_options[] = {
         { "plugins-dir", required_argument, NULL, OPT_PLUGINS_DIR},
         { "log-binary", no_argument, NULL, OPT_LOG_BINARY},
+        { "no-log-frames", no_argument, NULL, OPT_NO_LOG_FRAMES},
         { "help", no_argument, NULL, 'h'},
         { 0, 0, 0, 0}
     };
@@ -536,6 +539,9 @@ int main(int argc, char* argv[])
         case OPT_LOG_BINARY:
             log_binary = true;
             break;
+        case OPT_NO_LOG_FRAMES:
+            log_no_frames = true;
+            break;
         case 'l':
             log_filename = optarg;
             break;
-- 
2.14.3



More information about the Spice-devel mailing list