VirtualBox

Changeset 8179 in vbox


Ignore:
Timestamp:
Apr 19, 2008 10:01:06 AM (17 years ago)
Author:
vboxsync
Message:

Main: Added MyLog() macro for logging to the default log instance even when LOG_ENABLED is not set (or LOG_DISABLED is set).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/Logging.h

    r8155 r8179  
    5858    do { LogFlow (("{%p} ", this)); LogFlow (m); } while (0)
    5959
     60/** @def MyLogIt
     61 * Copy of LogIt that works even when logging is completely disabled (e.g. in
     62 * release builds) and doesn't interefere with the default release logger
     63 * instance (which is already in use by the VM process).
     64 */
     65#define MyLogIt(pvInst, fFlags, iGroup, fmtargs) \
     66    do \
     67    { \
     68        register PRTLOGGER LogIt_pLogger = (PRTLOGGER)(pvInst) ? (PRTLOGGER)(pvInst) : RTLogDefaultInstance(); \
     69        if (LogIt_pLogger) \
     70        { \
     71            register unsigned LogIt_fFlags = LogIt_pLogger->afGroups[(unsigned)(iGroup) < LogIt_pLogger->cGroups ? (unsigned)(iGroup) : 0]; \
     72            if ((LogIt_fFlags & ((fFlags) | RTLOGGRPFLAGS_ENABLED)) == ((fFlags) | RTLOGGRPFLAGS_ENABLED)) \
     73                LogIt_pLogger->pfnLogger fmtargs; \
     74        } \
     75    } while (0)
     76
     77/** @def MyLog
     78 * Equivalent to LogFlow but uses MyLogIt instead of LogIt
     79 */
     80#define MyLog(a)            MyLogIt(LOG_INSTANCE, RTLOGGRPFLAGS_FLOW, LOG_GROUP, a)
     81
    6082#endif // ____H_LOGGING
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