VirtualBox

Changeset 22708 in vbox for trunk


Ignore:
Timestamp:
Sep 2, 2009 11:40:56 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
51827
Message:

Main: comptr+webservice logging

Location:
trunk
Files:
6 edited

Legend:

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

    r22702 r22708  
    6767#include <VBox/com/assert.h>
    6868
     69#define LOGREF(prefix, pObj, cRefs) com::LogRef("%s {%p} cRefs=%d\n", (prefix), (pObj), (cRefs))
     70
    6971namespace com
    7072{
    71     #define LOGREF(prefix, pObj, cRefs) com::LogRef(#pObj "{%p}.refCnt=%d\n", (pObj), (cRefs));
    7273    void LogRef(const char *pcszFormat, ...);
    7374}
     
    8384    static void addref(C *p)
    8485    {
    85         size_t cRefs = p->AddRef();
     86        int cRefs = p->AddRef();
    8687        LOGREF("ADDREF ", p, cRefs);
    8788    }
    8889    static void release(C *p)
    8990    {
    90         size_t cRefs = p->Release();
    91         LOGREF("RELEASE ", p, cRefs);
    92         p->Release();
     91        int cRefs = p->Release();
     92        LOGREF("RELEASE", p, cRefs);
    9393    }
    9494};
     
    102102protected:
    103103
    104     static void addref  (C * /* p */) {}
    105     static void release (C * /* p */) {}
     104    static void addref(C * /* p */) {}
     105    static void release(C * /* p */) {}
    106106};
    107107
     
    120120 */
    121121template <class I1, class I2>
    122 inline bool ComPtrEquals (I1 *aThis, I2 *aThat)
     122inline bool ComPtrEquals(I1 *aThis, I2 *aThat)
    123123{
    124124    IUnknown *thatUnk = NULL, *thisUnk = NULL;
    125125    if (aThat)
    126         aThat->QueryInterface (COM_IIDOF (IUnknown), (void **) &thatUnk);
     126        aThat->QueryInterface(COM_IIDOF(IUnknown), (void**)&thatUnk);
    127127    if (aThis)
    128         aThis->QueryInterface (COM_IIDOF (IUnknown), (void **) &thisUnk);
    129     bool equal = thisUnk == thatUnk;
     128        aThis->QueryInterface(COM_IIDOF(IUnknown), (void**)&thisUnk);
     129    bool equal = (thisUnk == thatUnk);
    130130    if (thisUnk)
    131131        thisUnk->Release();
     
    137137/* specialization for <Any, IUnknown> */
    138138template <class I1>
    139 inline bool ComPtrEquals (I1 *aThis, IUnknown *aThat)
     139inline bool ComPtrEquals(I1 *aThis, IUnknown *aThat)
    140140{
    141141    IUnknown *thisUnk = NULL;
    142142    if (aThis)
    143         aThis->QueryInterface (COM_IIDOF (IUnknown), (void **) &thisUnk);
    144     bool equal = thisUnk == aThat;
     143        aThis->QueryInterface(COM_IIDOF(IUnknown), (void**)&thisUnk);
     144    bool equal = (thisUnk == aThat);
    145145    if (thisUnk)
    146146        thisUnk->Release();
     
    150150/** Specialization for <IUnknown, Any> */
    151151template <class I2>
    152 inline bool ComPtrEquals (IUnknown *aThis, I2 *aThat)
     152inline bool ComPtrEquals(IUnknown *aThis, I2 *aThat)
    153153{
    154154    IUnknown *thatUnk = NULL;
    155155    if (aThat)
    156         aThat->QueryInterface (COM_IIDOF (IUnknown), (void **) &thatUnk);
    157     bool equal = aThis == thatUnk;
     156        aThat->QueryInterface(COM_IIDOF(IUnknown), (void**)&thatUnk);
     157    bool equal = (aThis == thatUnk);
    158158    if (thatUnk)
    159159        thatUnk->Release();
     
    163163/* specialization for IUnknown */
    164164template<>
    165 inline bool ComPtrEquals <IUnknown, IUnknown> (IUnknown *aThis, IUnknown *aThat)
     165inline bool ComPtrEquals<IUnknown, IUnknown>(IUnknown *aThis, IUnknown *aThat)
    166166{
    167167    return aThis == aThat;
  • trunk/include/VBox/log.h

    r19315 r22708  
    325325    LOG_GROUP_VMM,
    326326    /** VRDP group */
    327     LOG_GROUP_VRDP
     327    LOG_GROUP_VRDP,
     328    /** Webservice group. */
     329    LOG_GROUP_WEBSERVICE
    328330    /* !!!ALPHABETICALLY!!! */
    329331} VBOX_LOGGROUP;
     
    478480    "VMM",          \
    479481    "VRDP",         \
     482    "WEBSERVICE",   \
    480483}
    481484
  • trunk/src/VBox/Main/glue/com.cpp

    r22702 r22708  
    5151#include <VBox/err.h>
    5252
    53 #include <Logging.h>
    54 
    5553#ifdef RT_OS_DARWIN
    5654#define VBOX_USER_HOME_SUFFIX   "Library/VirtualBox"
     
    5957#endif
    6058
     59#include "Logging.h"
    6160
    6261namespace com
  • trunk/src/VBox/Main/webservice/vboxweb.cpp

    r22666 r22708  
    2121 */
    2222
     23// shared webservice header
     24#include "vboxweb.h"
     25
    2326// vbox headers
    2427#include <VBox/com/com.h>
    25 #include <VBox/com/string.h>
    26 #include <VBox/com/Guid.h>
    2728#include <VBox/com/ErrorInfo.h>
    2829#include <VBox/com/errorprint.h>
    2930#include <VBox/com/EventQueue.h>
    30 #include <VBox/com/VirtualBox.h>
    31 #include <VBox/err.h>
    3231#include <VBox/VRDPAuth.h>
    3332#include <VBox/version.h>
    34 #include <VBox/log.h>
    3533
    3634#include <iprt/lock.h>
     
    4038#include <iprt/ctype.h>
    4139#include <iprt/process.h>
    42 #include <iprt/stream.h>
    4340#include <iprt/string.h>
    4441#include <iprt/ldr.h>
     
    5451// standard headers
    5552#include <map>
    56 #include <sstream>
    5753
    5854#ifdef __GNUC__
    5955#pragma GCC visibility pop
    6056#endif
    61 
    62 // shared webservice header
    63 #include "vboxweb.h"
    6457
    6558// include generated namespaces table
     
    215208    va_list args;
    216209    va_start(args, pszFormat);
    217     RTPrintfV(pszFormat, args);
     210    char *psz = NULL;
     211    RTStrAPrintfV(&psz, pszFormat, args);
    218212    va_end(args);
    219213
     214    // terminal
     215    RTPrintf("%s", psz);
     216
     217    // log file
    220218    if (g_pstrLog)
    221219    {
    222         va_list args2;
    223         va_start(args2, pszFormat);
    224         RTStrmPrintfV(g_pstrLog, pszFormat, args);
    225         va_end(args2);
    226 
     220        RTStrmPrintf(g_pstrLog, "%s", psz);
    227221        RTStrmFlush(g_pstrLog);
    228222    }
     223
     224    // logger instance
     225    RTLogLoggerEx(LOG_INSTANCE, RTLOGGRPFLAGS_DJ, LOG_GROUP, "%s", psz);
     226
     227    RTStrFree(psz);
    229228}
    230229
     
    541540 */
    542541void RaiseSoapFault(struct soap *soap,
    543                     const std::string &str,
     542                    const char *pcsz,
    544543                    int extype,
    545544                    void *ex)
    546545{
    547546    // raise the fault
    548     soap_sender_fault(soap, str.c_str(), NULL);
     547    soap_sender_fault(soap, pcsz, NULL);
    549548
    550549    struct SOAP_ENV__Detail *pDetail = (struct SOAP_ENV__Detail*)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail));
     
    587586
    588587    RaiseSoapFault(soap,
    589                    str,
     588                   str.c_str(),
    590589                   SOAP_TYPE__vbox__InvalidObjectFault,
    591590                   ex);
     
    648647
    649648    // compose descriptive message
    650     std::ostringstream ostr;
    651     ostr << std::hex << ex->resultCode;
    652 
    653     std::string str("VirtualBox error: ");
    654     str += ex->text;
    655     str += " (0x";
    656     str += ostr.str();
    657     str += ")";
     649    com::Utf8StrFmt str("VirtualBox error: %s (0x%RU32)", ex->text.c_str(), ex->resultCode);
    658650
    659651    RaiseSoapFault(soap,
    660                    str,
     652                   str.c_str(),
    661653                   SOAP_TYPE__vbox__RuntimeFault,
    662654                   ex);
     
    934926        WSDLT_ID id = pRef->toWSDL();
    935927        WEBDEBUG(("   %s: found existing ref %s for COM obj 0x%lX\n", __FUNCTION__, id.c_str(), ulp));
     928        LogDJ(("   %s: found existing ref %s for COM obj 0x%lX\n", __FUNCTION__, id.c_str(), ulp));
    936929    }
    937930    else
     
    10631056
    10641057    WEBDEBUG(("   * %s: MOR created for ulp 0x%lX (%s), new ID is %llX; now %lld objects total\n", __FUNCTION__, _ulp, pcszInterface, _id, cTotal));
     1058    LogDJ(("   * %s: MOR created for ulp 0x%lX (%s), new ID is %llX; now %lld objects total\n", __FUNCTION__, _ulp, pcszInterface, _id, cTotal));
    10651059}
    10661060
  • trunk/src/VBox/Main/webservice/vboxweb.h

    r22666 r22708  
    2727
    2828#define WEBDEBUG(a) if (g_fVerbose) { WebLog a; }
     29
     30#define LOG_GROUP LOG_GROUP_WEBSERVICE
     31#include <VBox/log.h>
     32
     33#include <VBox/com/VirtualBox.h>
     34#include <VBox/com/Guid.h>
     35
     36#include <VBox/err.h>
     37
     38#include <iprt/stream.h>
     39
     40#include <string>
     41
    2942
    3043/****************************************************************************
  • trunk/src/VBox/Main/webservice/websrv-cpp.xsl

    r22665 r22708  
    6060 */
    6161
     62// shared webservice header
     63#include "vboxweb.h"
     64
    6265// vbox headers
    6366#include <VBox/com/com.h>
    6467#include <VBox/com/array.h>
    65 #include <VBox/com/string.h>
    66 #include <VBox/com/Guid.h>
    6768#include <VBox/com/ErrorInfo.h>
    6869#include <VBox/com/errorprint.h>
    6970#include <VBox/com/EventQueue.h>
    70 #include <VBox/com/VirtualBox.h>
    71 #include <VBox/err.h>
    72 #include <VBox/log.h>
     71#include <VBox/VRDPAuth.h>
     72#include <VBox/version.h>
    7373
    7474#include <iprt/initterm.h>
     
    8282#include <map>
    8383#include <sstream>
    84 
    85 // shared webservice header
    86 #include "vboxweb.h"
    8784
    8885// shared strings for debug output
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