VirtualBox

Changeset 99616 in vbox


Ignore:
Timestamp:
May 5, 2023 8:48:06 AM (19 months ago)
Author:
vboxsync
Message:

Guest / Host: Added VBGHLogVerbosity[Get|Set](), removed external (global) as a requirement. bugref:10427

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/Log.h

    r99582 r99616  
    5353void VBGHLogVerbose(unsigned iLevel, const char *pszFormat, ...);
    5454void VBGHLogVerboseV(unsigned iLevel, const char *pszFormat, va_list va);
     55void VBGHLogVerbositySet(unsigned iLevel);
     56unsigned VBGHLogVerbosityGet(void);
    5557
    5658#endif /* !VBOX_INCLUDED_GuestHost_Log_h */
  • trunk/src/VBox/Additions/x11/VBoxClient/main.cpp

    r99585 r99616  
    738738                RTBldCfgVersion(), RTBldCfgRevisionStr(), g_cVerbosity);
    739739
     740    VBGHLogVerbositySet(g_cVerbosity);
     741
    740742    /* Try to detect the current session type early on, if needed. */
    741743    if (g_enmSessionType == VBGHSESSIONTYPE_AUTO)
  • trunk/src/VBox/GuestHost/Log.cpp

    r99580 r99616  
    3737
    3838/*********************************************************************************************************************************
    39 *   Externals                                                                                                                    *
     39*   Globals                                                                                                                      *
    4040*********************************************************************************************************************************/
    41 extern unsigned g_cVerbosity; /* Current verbosity level; must be provided by the implementation using this code. */
     41static unsigned g_vbghLogVerbosity = 0; /* Current guest/host log verbosity level. */
    4242
    4343
     
    130130 * Logs an error message with a va_list.
    131131 *
    132  * @param   pszFormat   Format string..
    133  * @param   va          Format arguments.
     132 * @param   pszFormat           Format string..
     133 * @param   va                  Format arguments.
    134134 */
    135135void VBGHLogErrorV(const char *pszFormat, va_list va)
     
    141141 * Logs an error message to the (release) logging instance.
    142142 *
    143  * @param   pszFormat               Format string to log.
     143 * @param   pszFormat           Format string to log.
    144144 */
    145145void VBGHLogError(const char *pszFormat, ...)
     
    151151 * Logs a info message with a va_list.
    152152 *
    153  * @param   pszFormat   Format string..
    154  * @param   va          Format arguments.
     153 * @param   pszFormat           Format string..
     154 * @param   va                  Format arguments.
    155155 */
    156156void VBGHLogInfoV(const char *pszFormat, va_list va)
     
    172172 * Logs a fatal error, notifies the desktop environment via a message (if available).
    173173 *
    174  * @param   pszFormat   Format string..
    175  * @param   va          Format arguments.
     174 * @param   pszFormat           Format string..
     175 * @param   va                  Format arguments.
    176176 */
    177177void VBGHLogFatalErrorV(const char *pszFormat, va_list va)
     
    197197 * set global verbosity level.
    198198 *
    199  * @param   iLevel      Minimum log level required to display this message.
    200  * @param   pszFormat   Format string.
    201  * @param   ...         Format arguments.
     199 * @param   iLevel              Minimum log level required to display this message.
     200 * @param   pszFormat           Format string.
     201 * @param   ...                 Format arguments.
    202202 */
    203203void VBGHLogVerbose(unsigned iLevel, const char *pszFormat, ...)
    204204{
    205     if (iLevel <= g_cVerbosity)
     205    if (iLevel <= g_vbghLogVerbosity)
    206206        VBGH_LOG_VA("", pszFormat);
    207207}
     
    211211 * set global verbosity level with a va_list.
    212212 *
    213  * @param   iLevel      Minimum log level required to display this message.
    214  * @param   pszFormat   Format string.
    215  * @param   va          Format arguments.
     213 * @param   iLevel              Minimum log level required to display this message.
     214 * @param   pszFormat           Format string.
     215 * @param   va                  Format arguments.
    216216 */
    217217void VBGHLogVerboseV(unsigned iLevel, const char *pszFormat, va_list va)
    218218{
    219     if (iLevel <= g_cVerbosity)
     219    if (iLevel <= g_vbghLogVerbosity)
    220220        VBGH_LOG_VALIST("", pszFormat, va);
    221221}
    222222
     223/**
     224 * Sets the verbosity level.
     225 * @param   iLevel              Verbosity level to set.
     226 *
     227 * @note Not thread safe.
     228 */
     229void VBGHLogVerbositySet(unsigned iLevel)
     230{
     231    g_vbghLogVerbosity = iLevel;
     232}
     233
     234/**
     235 * Gets the current verbosity level.
     236 *
     237 * @returns The current verbosity level.
     238 *
     239 * @note Not thread safe.
     240 */
     241unsigned VBGHLogVerbosityGet(void)
     242{
     243    return g_vbghLogVerbosity;
     244}
     245
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