VirtualBox

Changeset 22700 in vbox


Ignore:
Timestamp:
Sep 2, 2009 10:05:23 AM (15 years ago)
Author:
vboxsync
Message:

Main: comptr logging

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/ptr.h

    r22305 r22700  
    6767#include <VBox/com/assert.h>
    6868
     69namespace com
     70{
     71    #define LOGREF(pObj, cRefs) com::LogRef(#pObj "{%p}.refCnt=%d\n", (pObj), (cRefs));
     72    void LogRef(const char *pcszFormat, ...);
     73}
     74
    6975/**
    7076 *  Strong referencing operators. Used as a second argument to ComPtr<>/ComObjPtr<>.
     
    7581protected:
    7682
    77     static void addref (C *p) { p->AddRef(); }
    78     static void release (C *p) { p->Release(); }
     83    static void addref(C *p)
     84    {
     85        size_t cRefs = p->AddRef();
     86        LOGREF(p, cRefs);
     87    }
     88    static void release(C *p)
     89    {
     90        p->Release();
     91    }
    7992};
    8093
  • trunk/include/iprt/log.h

    r21953 r22700  
    402402    /** aleksey logging. */
    403403    RTLOGGRPFLAGS_ALEKSEY      = 0x00020000,
     404    /** dj logging. */
     405    RTLOGGRPFLAGS_DJ           = 0x00040000,
    404406    /** NoName logging. */
    405     RTLOGGRPFLAGS_NONAME       = 0x00040000
     407    RTLOGGRPFLAGS_NONAME       = 0x00080000
    406408} RTLOGGRPFLAGS;
    407409
     
    612614#define LogAleksey(a)   LogIt(LOG_INSTANCE, RTLOGGRPFLAGS_ALEKSEY,  LOG_GROUP, a)
    613615
     616/** @def LogDJ
     617 * dj logging.
     618 */
     619#define LogDJ(a)        LogIt(LOG_INSTANCE, RTLOGGRPFLAGS_DJ,  LOG_GROUP, a)
     620
    614621/** @def LogNoName
    615622 * NoName logging.
    616623 */
    617624#define LogNoName(a)    LogIt(LOG_INSTANCE, RTLOGGRPFLAGS_NONAME,   LOG_GROUP, a)
    618 
    619625
    620626/** @def LogWarning
  • trunk/include/iprt/xml_cpp.h

    r22173 r22700  
    3333#ifndef IN_RING3
    3434# error "There are no XML APIs available in Ring-0 Context!"
    35 #else /* IN_RING3 */
     35#endif
    3636
    3737#include <list>
     
    649649#endif
    650650
    651 #endif /* IN_RING3 */
    652 
    653651/** @} */
    654652
  • trunk/src/VBox/Main/glue/com.cpp

    r21878 r22700  
    4848#include <iprt/env.h>
    4949#include <iprt/string.h>
     50#include <iprt/log.h>
    5051
    5152#include <VBox/err.h>
     
    201202#endif /* (VBOX_WITH_XPCOM) */
    202203
     204/**
     205 * Used by ComPtr and friends to log details about reference counting.
     206 * @param pcszFormat
     207 */
     208void LogRef(const char *pcszFormat, ...)
     209{
     210    va_list va;
     211    va_start(va, pcszFormat);
     212    va_end(va);
     213
     214    char *psz = NULL;
     215    RTStrAPrintfV(&psz, pcszFormat, va);
     216    LogDJ((psz));
     217    RTStrFree(psz);
     218}
     219
    203220} /* namespace com */
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r22204 r22700  
    11751175            { "bird",       RTLOGGRPFLAGS_BIRD },
    11761176            { "aleksey",    RTLOGGRPFLAGS_ALEKSEY },
     1177            { "dj",         RTLOGGRPFLAGS_DJ },
    11771178            { "n",          RTLOGGRPFLAGS_NONAME },
    11781179            { "noname",     RTLOGGRPFLAGS_NONAME }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette