VirtualBox

Changeset 21375 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jul 7, 2009 10:46:18 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
49731
Message:

log.cpp: Make the ring-0 fallback logging more obvious and support the pid and tid prefixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r21337 r21375  
    8787#endif
    8888#ifdef IN_RING0
    89 static void rtR0LogLoggerExFallback(uint32_t fDestFlags, const char *pszFormat, va_list va);
     89static void rtR0LogLoggerExFallback(uint32_t fDestFlags, uint32_t fFlags, const char *pszFormat, va_list va);
    9090#endif
    9191static void rtlogFlush(PRTLOGGER pLogger);
     
    16871687#ifdef IN_RING0
    16881688        if (pLogger->fDestFlags & ~RTLOGDEST_FILE)
    1689             rtR0LogLoggerExFallback(pLogger->fDestFlags, pszFormat, args);
     1689            rtR0LogLoggerExFallback(pLogger->fDestFlags, pLogger->fFlags, pszFormat, args);
    16901690#endif
    16911691        return;
     
    18261826 * for the present, because it's too much hazzle.
    18271827 *
    1828  * @param   pLogger     The destination flags.
     1828 * @param   fDestFlags  The destination flags.
     1829 * @param   fFlags      The logger flags.
    18291830 * @param   pszFormat   The format string.
    18301831 * @param   va          The format arguments.
    18311832 */
    1832 static void rtR0LogLoggerExFallback(uint32_t fDestFlags, const char *pszFormat, va_list va)
     1833static void rtR0LogLoggerExFallback(uint32_t fDestFlags, uint32_t fFlags, const char *pszFormat, va_list va)
    18331834{
    18341835    RTR0LOGLOGGERFALLBACK This;
    18351836    This.fDestFlags = fDestFlags;
    1836     This.offScratch = 0;
     1837
     1838    /* fallback indicator. */
     1839    This.offScratch = 2;
     1840    This.achScratch[0] = '[';
     1841    This.achScratch[1] = 'F';
     1842
     1843    /* selected prefixes */
     1844    if (fFlags & RTLOGFLAGS_PREFIX_PID)
     1845    {
     1846        RTPROCESS Process = RTProcSelf();
     1847        This.achScratch[This.offScratch++] = ' ';
     1848        This.offScratch += RTStrFormatNumber(&This.achScratch[This.offScratch], Process, 16, sizeof(RTPROCESS) * 2, 0, RTSTR_F_ZEROPAD);
     1849    }
     1850    if (fFlags & RTLOGFLAGS_PREFIX_TID)
     1851    {
     1852        RTNATIVETHREAD Thread = RTThreadNativeSelf();
     1853        This.achScratch[This.offScratch++] = ' ';
     1854        This.offScratch += RTStrFormatNumber(&This.achScratch[This.offScratch], Thread, 16, sizeof(RTNATIVETHREAD) * 2, 0, RTSTR_F_ZEROPAD);
     1855    }
     1856
     1857    This.achScratch[This.offScratch++] = ']';
     1858    This.achScratch[This.offScratch++] = ' ';
     1859
    18371860    RTLogFormatV(rtR0LogLoggerExFallbackOutput, &This, pszFormat, va);
    18381861}
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