← Back to team overview

rohc team mailing list archive

Re: [Question #264108]: Disabling debug prints on console

 

Question #264108 on rohc changed:
https://answers.launchpad.net/rohc/+question/264108

    Status: Open => Answered

Didier Barvaux proposed the following answer:
Hello,

The redirection to /dev/null to hide the debug content is a trick, but
there is a better way to perform this with the library itself.

For the /dev/null redirection to work however, you have to:
 - apply it on the program that you run (not on the compiler gcc)
 - you have to use the correct syntax, ie. :    yourprogamname yourarguments > /dev/null 2>&1
    (your examples miss the > character before /dev/null)

Now, back on the proper way to hide the output. The ROHC library used to
print the debug traces on stdout. That was a bad habit inherited from
the early versions. As of 1.5.0 or 1.6.0 (I'm not sure of the exact
version), I added a way for the programs to handle the library traces
itself. However, to avoid changing the library behavior in the 1.x.y
versions, I kept the default behavior to "print traces on stdout by
default". This will change in the future 2.0.0 version that will leave
behind compatibility with the 1.x.y versions.

In short:
 - with the future 2.0.0 version, you'll have nothing to do.
 - with the current 1.7.x versions, you need to use the rohc_comp_set_traces_cb2() and rohc_decomp_set_traces_cb2()  functions. To disable all traces, specify NULL as callback.

Short examples:
   rohc_comp_set_traces_cb2(compressor, NULL);
   rohc_decomp_set_traces_cb2(decompressor, NULL); 

Longer examples:
  see the examples/rtp_detection.c example in the sources.

API documentation for those functions:
  https://rohc-lib.org/support/documentation/API/rohc-doc-1.7.0/group__rohc__comp.html#ga1d473a3062db32a17c76ab142410c541 
  https://rohc-lib.org/support/documentation/API/rohc-doc-1.7.0/group__rohc__decomp.html#ga9bcd25e2a96356a83cc87b34cc8fa73a


Regards,
Didier

-- 
You received this question notification because you are a member of ROHC
Team, which is an answer contact for rohc.