VirtualBox

Ignore:
Timestamp:
Aug 1, 2022 1:26:39 PM (2 years ago)
Author:
vboxsync
Message:

Additions/VBoxTray: Enable (optional) release logging, handle log groups a bit more elegant. bugref:10267

Location:
trunk/src/VBox/Additions/WINNT/VBoxTray
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/Makefile.kmk

    r95862 r95959  
    3131 VBoxTray_DEFS   := VBOX_WITH_HGCM VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
    3232endif
     33VBoxTray_DEFS    += LOG_ENABLED
    3334VBoxTray_LDFLAGS  = -SubSystem:Windows
    3435VBoxTray_INCS     = \
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp

    r95833 r95959  
    2121*********************************************************************************************************************************/
    2222#define LOG_GROUP LOG_GROUP_GUEST_DND
     23#include <VBox/log.h>
     24
    2325#include <iprt/win/windows.h>
    2426#include "VBoxTray.h"
     
    4345
    4446#include <VBox/err.h>
    45 #include <VBox/log.h>
    4647
    4748
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.cpp

    r95877 r95959  
    589589        RTLogSetDefaultInstance(g_pLoggerRelease);
    590590
    591         switch (g_cVerbosity) /* Not very elegant, but has to do it for now. */
    592         {
    593             case 1:
    594                 rc = RTLogGroupSettings(g_pLoggerRelease, "all.e.l");
     591        const char *apszGroups[] = { "all", "guest_dnd" }; /* All groups we want to enable logging for VBoxTray. */
     592        char        szGroupSettings[_1K];
     593
     594        szGroupSettings[0] = '\0';
     595
     596        for (size_t i = 0; i < RT_ELEMENTS(apszGroups); i++)
     597        {
     598            if (i > 0)
     599                rc = RTStrCat(szGroupSettings, sizeof(szGroupSettings), "+");
     600            if (RT_SUCCESS(rc))
     601                rc = RTStrCat(szGroupSettings, sizeof(szGroupSettings), apszGroups[i]);
     602            if (RT_FAILURE(rc))
    595603                break;
    596604
    597             case 2:
    598                 rc = RTLogGroupSettings(g_pLoggerRelease, "all.e.l.l2");
     605            switch (g_cVerbosity)
     606            {
     607                case 1:
     608                    rc = RTStrCat(szGroupSettings, sizeof(szGroupSettings), ".e.l");
     609                    break;
     610
     611                case 2:
     612                    rc = RTStrCat(szGroupSettings, sizeof(szGroupSettings), ".e.l.l2");
     613                    break;
     614
     615                case 3:
     616                    rc = RTStrCat(szGroupSettings, sizeof(szGroupSettings), ".e.l.l2.l3");
     617                    break;
     618
     619                case 4:
     620                    RT_FALL_THROUGH();
     621                default:
     622                    rc = RTStrCat(szGroupSettings, sizeof(szGroupSettings), ".e.l.l2.l3.f");
     623                    break;
     624            }
     625
     626            if (RT_FAILURE(rc))
    599627                break;
    600 
    601             case 3:
    602                 rc = RTLogGroupSettings(g_pLoggerRelease, "all.e.l.l2.l3");
    603                 break;
    604 
    605             case 4:
    606                 RT_FALL_THROUGH();
    607             default:
    608                 rc = RTLogGroupSettings(g_pLoggerRelease, "all.e.l.l2.l3.f");
    609                 break;
    610         }
     628        }
     629
     630        LogRel(("Verbose log settings are: %s\n", szGroupSettings));
     631
     632        if (RT_SUCCESS(rc))
     633            rc = RTLogGroupSettings(g_pLoggerRelease, szGroupSettings);
    611634        if (RT_FAILURE(rc))
    612             RTMsgError("Setting debug logging failed, rc=%Rrc\n", rc);
     635            RTMsgError("Setting log group settings failed, rc=%Rrc\n", rc);
    613636
    614637        /* Explicitly flush the log in case of VBOXTRAY_RELEASE_LOG=buffered. */
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