
                              Wine Documentation                               
Prev                       Chapter 8. Debug Logging                        Next
-------------------------------------------------------------------------------

How to use it

So, to output a message (class YYY) on channel xxx, do:
#include "debug.h"                                                             
                                                                               
....                                                                           
                                                                               
YYY(xxx, "<message>", ...);                                                    
                                                                               

Some examples from the code:
#include "debug.h"                                                             
                                                                               
...                                                                            
                                                                               
  TRACE(crtdll, "CRTDLL_setbuf(file %p buf %p)", file, buf);                   
                                                                               
  WARN(aspi, "Error opening device errno=%d", save_error);                     
                                                                               

If you need to declare a new debugging channel, use it in your code and then
do:
%tools/make_debug                                                              
                                                                               

in the root directory of Wine. Note that this will result in almost complete
recompilation of Wine.
   
   
     1. Please pay attention to which class you assign the message. There are
        only 4 classes, so it is not hard. The reason it is important to get it
        right is that too much information is no information. For example, if
        you put things into the WARN class that should really be in the TRACE
        class, the output will be too big and this will force the user to turn
        warnings off. But this way he will fail to see the important ones.
        Also, if you put warnings into the TRACE class lets say, he will most
        likely miss those because usually the TRACE class is turned off. A
        similar argument can be made if you mix any other two classes.
       
     2. All lines should end with a newline. If you can NOT output everything
        that you want in the line with only one statement, then you need to
        build the string in memory. Please read the section below "In-memory
        messages" on the preferred way to do it. PLEASE USE THAT INTERFACE TO
        BUILD MESSAGES IN MEMORY. The reason is that we are not sure that we
        like it and having everything in one format will facilitate the
        (automatic) translation to a better interface.
       

-------------------------------------------------------------------------------
Prev                                  Home                                 Next
Debugging channels                     Up                     Are we debugging?
