VirtualBox

Changeset 32355 in vbox


Ignore:
Timestamp:
Sep 9, 2010 1:43:02 PM (14 years ago)
Author:
vboxsync
Message:

IPRT: Added RTLogRelSetBuffering and RTLogSetBuffering.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/log.h

    r31399 r32355  
    11811181RTDECL(void) RTLogRelPrintfV(const char *pszFormat, va_list args);
    11821182
     1183/**
     1184 * Changes the buffering setting of the default release logger.
     1185 *
     1186 * This can be used for optimizing longish logging sequences.
     1187 *
     1188 * @returns The old state.
     1189 * @param   fBuffered       The new state.
     1190 */
     1191RTDECL(bool) RTLogRelSetBuffering(bool fBuffered);
    11831192
    11841193/** @} */
     
    15421551 */
    15431552RTDECL(int) RTLogFlags(PRTLOGGER pLogger, const char *pszVar);
     1553
     1554/**
     1555 * Changes the buffering setting of the specified logger.
     1556 *
     1557 * This can be used for optimizing longish logging sequences.
     1558 *
     1559 * @returns The old state.
     1560 * @param   pLogger         The logger instance (NULL is an alias for the
     1561 *                          default logger).
     1562 * @param   fBuffered       The new state.
     1563 */
     1564RTDECL(bool) RTLogSetBuffering(PRTLOGGER pLogger, bool fBuffered);
    15441565
    15451566#ifndef IN_RC
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r30965 r32355  
    14301430}
    14311431RT_EXPORT_SYMBOL(RTLogFlags);
     1432
     1433
     1434/**
     1435 * Changes the buffering setting of the specified logger.
     1436 *
     1437 * This can be used for optimizing longish logging sequences.
     1438 *
     1439 * @returns The old state.
     1440 * @param   pLogger         The logger instance (NULL is an alias for the
     1441 *                          default logger).
     1442 * @param   fBuffered       The new state.
     1443 */
     1444RTDECL(bool) RTLogSetBuffering(PRTLOGGER pLogger, bool fBuffered)
     1445{
     1446    bool fOld;
     1447
     1448    /*
     1449     * Resolve the logger instance.
     1450     */
     1451    if (!pLogger)
     1452    {
     1453        pLogger = RTLogDefaultInstance();
     1454        if (!pLogger)
     1455            return false;
     1456    }
     1457
     1458    rtlogLock(pLogger);
     1459    fOld  = !!(pLogger->fFlags & RTLOGFLAGS_BUFFERED);
     1460    if (fBuffered)
     1461        pLogger->fFlags |= RTLOGFLAGS_BUFFERED;
     1462    else
     1463        pLogger->fFlags &= ~RTLOGFLAGS_BUFFERED;
     1464    rtlogUnlock(pLogger);
     1465
     1466    return fOld;
     1467}
     1468RT_EXPORT_SYMBOL(RTLogSetBuffering);
     1469
    14321470
    14331471
  • trunk/src/VBox/Runtime/common/log/logrel.cpp

    r30111 r32355  
    146146RT_EXPORT_SYMBOL(RTLogRelPrintfV);
    147147
     148
     149/**
     150 * Changes the buffering setting of the default release logger.
     151 *
     152 * This can be used for optimizing longish logging sequences.
     153 *
     154 * @returns The old state.
     155 * @param   fBuffered       The new state.
     156 */
     157RTDECL(bool) RTLogRelSetBuffering(bool fBuffered)
     158{
     159    PRTLOGGER pLogger = RTLogRelDefaultInstance();
     160    if (pLogger)
     161        return RTLogSetBuffering(pLogger, fBuffered);
     162    return false;
     163}
     164RT_EXPORT_SYMBOL(RTLogRelSetBuffering);
     165
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