VirtualBox

Changeset 32355 in vbox for trunk/src


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

IPRT: Added RTLogRelSetBuffering and RTLogSetBuffering.

Location:
trunk/src/VBox/Runtime/common/log
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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